linuxdjangoamazon-ec2uwsgi

linux ami nginx sites_enabled missing


We are trying to install nginx on a Amazon Linux AMI to config uwsgi and django. But there is no sites-enabled dir under etc/nginx unlike on Ubuntu.

What am I missing here?

We are trying follow instructions from http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html


Solution

  • Amazon Linux is based on RedHat/CentOS/Fedora so the default installation of nginx doesn't have a sites-avalable or a sites-enabled directory. (As opposed to Debian/Ubuntu) The directory where you usually put your configs is /etc/nginx/conf.d

    Having said that, if you really want the sites-available/sites-enabled directories you can just run:

    mkdir -p /etc/nginx/sites-enabled
    mkdir -p /etc/nginx/sites-available
    

    Then make sure the following is in the http section of your /etc/nginx/nginx.conf:

    include /etc/nginx/sites-enabled/*.conf;
    

    Then if you want to create a specific site configuration you can create your file 'whatever.conf' under /etc/nginx/sites-available . To enable it:

    ln -s /etc/nginx/sites-available/whatever.conf /etc/nginx/sites-enabled/whatever.conf
    service nginx restart