4

This is my first time using nginx and I'm having some problems configuring an nginx.conf file. What I have is

server {
    location ~ /(application|system) {
        deny all;
        return 404;
    }

    rewrite  ^(.*)$  /index.php/$1  break;
}

In case it's not clear; I'm trying to block access to the directories application and system and rewrite all other requests to the index.php. I've tried validating the nginx.conf file using: ian@ubuntu:~$ sudo nginx -t -c path_to_conf_file but get [emerg]: unknown directive "server".... Any ideas what I might be doing wrong?

1 Answer 1

14

You need to make sure the server directive is inside of the http directive if I recall.

eg:

http {

    //various nginx settings here

    server {
        //server stuff here
    }

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.