0

Error with nginx (Jooma config)

Ngô Nhật Huy 9 years ago updated by Lynx Luo 9 years ago 2
When I add follow https://docs.joomla.org/Nginx#Configure_Nginx
server {
        listen 80;
        server_name angelnails.manchieucong.com;
        server_name_in_redirect off;

        access_log /var/log/nginx/localhost.access_log;
        error_log /var/log/nginx/localhost.error_log info;

        root /srv/angelnails;
        index index.php index.html index.htm default.html default.htm;
        # Support Clean (aka Search Engine Friendly) URLs
        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        # deny running scripts inside writable directories
        location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403_error.html;
        }

        location ~ \.php$ {
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi.conf;
        }

        # caching of files 
        location ~* \.(ico|pdf|flv)$ {
                expires 1y;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
        }

}
nginx service is stop
When I use service nginx restart
Starting nginx: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/conf.d/angel-nails.conf:18
nginx: configuration file /etc/nginx/nginx.conf test failed

I don't know what is wrong.
Help me.
I fixed it.
Just only copy below to Advanced tab when create website

# Support Clean (aka Search Engine Friendly) URLs
location / {
try_files $uri $uri/ /index.php?$args;
}

# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}

# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}

location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}

It didn't work for mine. I just restore a Joomla site from a launcher package. The back office is normal but its front office components is orderless. It look like: http://morext.com:8080/ but actually it should be like: http://demo.rockettheme.com/joomla-templates/hexeris/


Any concepts or solutions for this? Please give a hand! Thanks!