Fab Deploy Error: '“Error log: [emerg] 8780#0: invalid server name or wildcard ”mydomain*.mydomain.com“ on”'


I've been stuck on this deployment error for days, help! Our project is in the last step of deployment cd to the /home/django/django_project directory and run "fab deploy". Our project errors out on the supervisorctl start my_app: gunicorn command within our "fabfile.py" with the follow error code.:

"[555.555.55.555] out: my_app:gunicorn_my_app: ERROR (abnormal termination) "

Below are error logs.


:: Important configuration files in this directory **nginx.conf**


:: Important configuration files in this directory **my_app.conf**


:: Important error log files in this directory **supervisord.log**

"INFO spawned: 'gunicorn_my_app' with pid 11575
INFO exited: gunicorn_my_app (exit status 1; not expected)
INFO gave up: gunicorn_my_app entered FATAL state, too many start retries too quickly"

:: Important error log files in this directory **error.log.1**

Error log:  2015/01/02 18:21:42 [emerg] 8780#0: invalid server name or wildcard "mydomain*.mydomain.com" on

I changed the server name variable in our nginx.conf file but for some reason it hasn't been updated when this command runs.

I probably can't help, but I'll throw some things out there.

You haven't provided any of your configs for nginx or gunicorn, which would be helpful. Perhaps you could provide those so others can take a look at them?


From the logs it seems like gunicorn is taking a poop somewhere in the process of attempting to launch. Perhaps a configuration error may be preventing the server from starting. If you haven't done so yet it's worth checking that your configs are kosher.

From the gunicorn configuration documentation:

To check your configuration when using the command line or the configuration file you can run the following command:

$ gunicorn my_app:gunicorn_my_app --check-config

It will also allow you to know if your application can be launched.

If everything comes back fine, then you can probably rule that out and take a deeper look. Gunicorn has a debug option that should let you see in great detail what exactly is going wrong. The docs say it can be done with the --debug option, like so:

$ gunicorn my_app:gunicorn_my_app --debug

Hopefully that should get you a little closer to understanding what's up.


I don't know if you're getting that nginx error every time you're trying to start the server, but I'll take a stab at what I can see in that error log.

Nginx only supports wildcard server names at beginning or the end of the name.

From the nginx documentation on server names:

A wildcard name may contain an asterisk only on the name’s start or end, and only on a dot border. The names “www..example.org” and “w.example.org” are invalid. However, these names can be specified using regular expressions, for example, “~^www..+.example.org$” and “~^w..example.org$”. An asterisk can match several name parts. The name “.example.org” matches not only www.example.org but www.sub.example.org as well.

To listen on mydomain*.mydomain.com, you would use a regular expression in the server_name directive in the server block of your nginx.conf file.

The following regular expression would achieve this:


and you would put it in your nginx.conf like so:

server {
    server_name     ~^mydomain(\S*)\.mydomain\.com$;

And after saving any changes to your nginx.conf, always running this command is good practice:

$ sudo nginx -t

Just like gunicorn's --check-config, it parses your configuration files to check that there are no errors, and it will tell you if there are any that need fixing.

Apologies if this answer isn't ultimately useful.

By : Trappist

This video can help you solving your question :)
By: admin