-1

Nginx is not starting or restarting, and gives the error: "nginx: [emerg] "location" directive is not allowed here in /home/admin/conf/web/nginx.conf:100".

I understand that this is because a location section is not inside of the { } tags, but this account's config file is pretty large and I do not know how to fix this.

Old code took up too much space to post.

Thanks for any help!

Updated Config:

server {
listen      192.168.0.39:80;
server_name test-page.ga www.test-page.ga;
error_log  /var/log/apache2/domains/test-page.ga.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/test-page.ga/public_html;
        access_log     /var/log/apache2/domains/test-page.ga.log combined;
        access_log     /var/log/apache2/domains/test-page.ga.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/test-page.ga/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.test-page.ga.conf*;
}

server {
listen      192.168.0.39:80;
server_name mailmyserver.ga www.mailmyserver.ga;
error_log  /var/log/apache2/domains/mailmyserver.ga.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/mailmyserver.ga/public_html;
        access_log     /var/log/apache2/domains/mailmyserver.ga.log combined;
        access_log     /var/log/apache2/domains/mailmyserver.ga.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/mailmyserver.ga/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.mailmyserver.ga.conf*;
}

server {
listen      192.168.0.39:80;
server_name globalcdg.ga www.globalcdg.ga;
error_log  /var/log/apache2/domains/globalcdg.ga.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/globalcdg.ga/public_html;
        access_log     /var/log/apache2/domains/globalcdg.ga.log combined;
        access_log     /var/log/apache2/domains/globalcdg.ga.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/globalcdg.ga/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.globalcdg.ga.conf*;
}

server {
listen      192.168.0.39:80;
server_name lifepost.site www.lifepost.site;
error_log  /var/log/apache2/domains/lifepost.site.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/lifepost.site/public_html;
        access_log     /var/log/apache2/domains/lifepost.site.log combined;
        access_log     /var/log/apache2/domains/lifepost.site.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/lifepost.site/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.lifepost.site.conf*;
}

server {
listen      192.168.0.39:80;
server_name cdgmediagroup.com www1.cdgmediagroup.com www.cdgmediagroup.com;
error_log  /var/log/apache2/domains/cdgmediagroup.com.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/cdgmediagroup.com/public_html;
        access_log     /var/log/apache2/domains/cdgmediagroup.com.log combined;
        access_log     /var/log/apache2/domains/cdgmediagroup.com.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/cdgmediagroup.com/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.cdgmediagroup.com.conf*;
}

server {
listen      192.168.0.39:80;
server_name cartergames.ga www.cartergames.ga;
error_log  /var/log/apache2/domains/cartergames.ga.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/cartergames.ga/public_html;
        access_log     /var/log/apache2/domains/cartergames.ga.log combined;
        access_log     /var/log/apache2/domains/cartergames.ga.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/cartergames.ga/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.cartergames.ga.conf*;
}

server {
listen      192.168.0.39:80;
server_name oregondate.space www.oregondate.space;
error_log  /var/log/apache2/domains/oregondate.space.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/oregondate.space/public_html;
        access_log     /var/log/apache2/domains/oregondate.space.log combined;
        access_log     /var/log/apache2/domains/oregondate.space.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/oregondate.space/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.oregondate.space.conf*;
}

server {
listen      192.168.0.39:80;
server_name testdummies.cf www.testdummies.cf;
error_log  /var/log/apache2/domains/testdummies.cf.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/testdummies.cf/public_html;
        access_log     /var/log/apache2/domains/testdummies.cf.log combined;
        access_log     /var/log/apache2/domains/testdummies.cf.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/testdummies.cf/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.testdummies.cf.conf*;
}

server {
listen      192.168.0.39:80;
server_name cdg.tech www.cdg.tech;
error_log  /var/log/apache2/domains/cdg.tech.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/cdg.tech/public_html;
        access_log     /var/log/apache2/domains/cdg.tech.log combined;
        access_log     /var/log/apache2/domains/cdg.tech.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/cdg.tech/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.cdg.tech.conf*;
}

server {
listen      192.168.0.39:80;
server_name complexwebs.com www1.complexwebs.com www.complexwebs.com;
error_log  /var/log/apache2/domains/complexwebs.com.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/complexwebs.com/public_html;
        access_log     /var/log/apache2/domains/complexwebs.com.log combined;
        access_log     /var/log/apache2/domains/complexwebs.com.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/complexwebs.com/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.complexwebs.com.conf*;
}

server {
listen      192.168.0.39:80;
server_name cdghost.xyz www.cdghost.xyz cdghost-xyz.beta.cdg.tech;
error_log  /var/log/apache2/domains/cdghost.xyz.error.log error;

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/cdghost.xyz/public_html;
        access_log     /var/log/apache2/domains/cdghost.xyz.log combined;
        access_log     /var/log/apache2/domains/cdghost.xyz.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/cdghost.xyz/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.cdghost.xyz.conf*;
}

server {
listen      192.168.0.39:80;
server_name srv39.cdghost.xyz www.srv39.cdghost.xyz srv39-cdghost-xyz.srv39.cdghost.xyz;
error_log  /var/log/apache2/domains/srv39.cdghost.xyz.error.log error;

location /.well-known/acme-challenge {
    alias /etc/letsencrypt/.well-known/acme-challenge;
    location ~ /.well-known/acme-challenge/(.*) {
        add_header Content-Type text/plain;
    }
}

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/srv39.cdghost.xyz/public_html;
        access_log     /var/log/apache2/domains/srv39.cdghost.xyz.log combined;
        access_log     /var/log/apache2/domains/srv39.cdghost.xyz.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/srv39.cdghost.xyz/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.srv39.cdghost.xyz.conf*;
}

server {
listen      192.168.0.39:80;
server_name mlinks.ml www.mlinks.ml mlinks-ml.srv39.cdghost.xyz;
error_log  /var/log/apache2/domains/mlinks.ml.error.log error;

location /.well-known/acme-challenge {
    alias /etc/letsencrypt/.well-known/acme-challenge;
    location ~ /.well-known/acme-challenge/(.*) {
        add_header Content-Type text/plain;
    }
}

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/mlinks.ml/public_html;
        access_log     /var/log/apache2/domains/mlinks.ml.log combined;
        access_log     /var/log/apache2/domains/mlinks.ml.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/mlinks.ml/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.mlinks.ml.conf*;
}

server {
listen      192.168.0.39:80;
server_name zearch.ga www.zearch.ga zearch-ga.srv39.cdghost.xyz;
error_log  /var/log/apache2/domains/zearch.ga.error.log error;

location /.well-known/acme-challenge {
    alias /etc/letsencrypt/.well-known/acme-challenge;
    location ~ /.well-known/acme-challenge/(.*) {
        add_header Content-Type text/plain;
    }
}

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/zearch.ga/public_html;
        access_log     /var/log/apache2/domains/zearch.ga.log combined;
        access_log     /var/log/apache2/domains/zearch.ga.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/zearch.ga/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.zearch.ga.conf*;
}

server {
listen      192.168.0.39:80;
server_name getlifepost.cu.cc www.getlifepost.cu.cc getlifepost-cu-cc.srv39.cdghost.xyz;
error_log  /var/log/apache2/domains/getlifepost.cu.cc.error.log error;

location /.well-known/acme-challenge {
    alias /etc/letsencrypt/.well-known/acme-challenge;
    location ~ /.well-known/acme-challenge/(.*) {
        add_header Content-Type text/plain;
    }
}

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/getlifepost.cu.cc/public_html;
        access_log     /var/log/apache2/domains/getlifepost.cu.cc.log combined;
        access_log     /var/log/apache2/domains/getlifepost.cu.cc.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/getlifepost.cu.cc/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.getlifepost.cu.cc.conf*;
}

server {
listen      192.168.0.39:80;
server_name truos.ga www.truos.ga truos-ga.srv39.cdghost.xyz;
error_log  /var/log/apache2/domains/truos.ga.error.log error;

location /.well-known/acme-challenge {
    alias /etc/letsencrypt/.well-known/acme-challenge;
    location ~ /.well-known/acme-challenge/(.*) {
        add_header Content-Type text/plain;
    }
}

location / {
    proxy_pass      http://192.168.0.39:8080;
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/truos.ga/public_html;
        access_log     /var/log/apache2/domains/truos.ga.log combined;
        access_log     /var/log/apache2/domains/truos.ga.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/truos.ga/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.truos.ga.conf*;
}

1 Answers1

3

Your problem happens because you're not using proper indentation and not separating out your server blocks into separate files so that you could enable and disable configs for testing.

Regardless, nginx actually tells you exactly where the problem is. nginx: [emerg] "location" directive is not allowed here in /home/admin/conf/web/nginx.conf:100

The :100 part means on line 100. If you check line 100 of the file you'll see you have the following blocks.

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.globalcdg.ga.conf*;
} # <---- You're closing the server block here.

# Looks like you're missing the opening server block here.
    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
        root           /home/admin/web/lifepost.site/public_html;
        access_log     /var/log/apache2/domains/lifepost.site.log combined;
        access_log     /var/log/apache2/domains/lifepost.site.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/lifepost.site/document_errors/;
}

location @fallback {
    proxy_pass      http://192.168.0.39:8080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.lifepost.site.conf*;
} # <--- this ends the partial server block.
Martin Fjordvald
  • 7,749
  • 1
  • 30
  • 35
  • So if I indent this, will it fix the problem? Also, the indentation is partially messed up from pasting into serverfault. – Carter Roeser Jan 21 '16 at 06:59
  • No, that would just help you spot problems easier. The problem really is because there's a server block opening tag missing. Open your config in an editor that shows line numbers and look at line 100. You're closing your server block and then immediately opening a location block. If the file is auto generated it sounds like a bug in the control panel software. – Martin Fjordvald Jan 21 '16 at 07:01
  • Okay, ill try to fix this but ill also contact the staff at Vesta, (they have pretty good support) and see if they have any way to fix this from happening again. – Carter Roeser Jan 21 '16 at 07:03
  • Can you update the question with your new config? – Martin Fjordvald Jan 21 '16 at 07:09
  • Yes one moment, I need to transfer the file. By the way, its odd, the same error happened on one of the other accounts running on my server, I believe I have fixed it though. – Carter Roeser Jan 21 '16 at 07:12
  • Okay, theres the new code, and nginx is running now! – Carter Roeser Jan 21 '16 at 07:24