You are not logged in.

#1 2013-05-23 22:39:43

AJCR
Member
Registered: 2012-12-14
Posts: 14

Nginx conf not working all of a sudden. What's wrong?

First of all, let me state that I am brand new to nginx and I have not yet gotten to that point where I am able to diagnose issues on my own. So I am hoping one of you guys will be able to help me out!

I had a VPS running with nginx and the following file, but then I HAD to delete the installed operating system and reinstall Arch Linux. It was working with THIS EXACT configuration file (nginx.conf) and now after I reinstalled the VPS and reuploaded the same exact conf file (I made a backup of it before reinstalling) it refuses to work. When I "sudo systemctl restart nginx", it gives me the following error: "Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details."

This is the conf file I am referring to:
   

    #user html;
    worker_processes  4;

    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;

    #pid        logs/nginx.pid;


    events {
    worker_connections  1024;
    }


    http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;
	
	server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        location ~ \.php$ {
	fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
      	fastcgi_index  index.php;
      	root   /usr/share/nginx/html;
      	include        fastcgi.conf;
        }

        location ~ /\.ht {
            deny  all;
        }
    }
	

    server {
        listen       80;
        server_name  www.brackishmedia.com brackishmedia.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/brackishmedia.com/html;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        location ~ \.php$ {
		fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
      	fastcgi_index  index.php;
      	root   /usr/share/nginx/brackishmedia.com/html;
      	include        fastcgi.conf;
        }

        location ~ /\.ht {
            deny  all;
        }
    }
	
	include /usr/share/nginx/rescuechurchmiami.com/conf/*;

    }

If I remove the following part:

    server {
        listen       80;
        server_name  www.brackishmedia.com brackishmedia.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/brackishmedia.com/html;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        location ~ \.php$ {
		fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
      	fastcgi_index  index.php;
      	root   /usr/share/nginx/brackishmedia.com/html;
      	include        fastcgi.conf;
        }

        location ~ /\.ht {
            deny  all;
        }
    }
	
	include /usr/share/nginx/rescuechurchmiami.com/conf/*;

and do a sudo systemctl restart nginx, it works perfectly. However, I need those that other server block in there and that "include /usr/share/nginx/rescuechurchmiami.com/conf/*;" goes to a configuration file that is specifically for a WordPress install.

So these are the issues I am having. Any suggestions on fixing it? I don't even understand why it won't just work like it did on the former VPS anyway.

Thank you,
AJ

Offline

#2 2013-05-24 15:48:55

teekay
Member
Registered: 2011-10-26
Posts: 271

Re: Nginx conf not working all of a sudden. What's wrong?

Try following in both server{} directives:

listen    *:80

The vhost listen behaviour changed in nginx 1.4.

Offline

Board footer

Powered by FluxBB