Problems with nginx.conf

This is my first time using nginx and I am having trouble setting up the nginx.conf file. I have

server { location ~ /(application|system) { deny all; return 404; } rewrite ^(.*)$ /index.php/$1 break; } 

If this is not clear; I am trying to block access to the application and the directory system and rewrite all other requests in index.php. I tried to check the nginx.conf file using: ian@ubuntu :~$ sudo nginx -t -c path_to_conf_file , but we get [emerg]: unknown directive "server"... Any ideas what I can do wrong?

+4
source share
1 answer

If I remember, you need to make sure that the server directive is inside the http directive.

eg:

 http { //various nginx settings here server { //server stuff here } } 
+14
source

All Articles