Error when using nginx config file

Hi

I am using a part of the ngix config file from the docs to include into my main nginx config file.

# Cache static files for as long as possible
location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
    try_files $uri =404;
    expires max;
    access_log off;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

# Deny access to configuration files
location ~* ^/_config {
    deny all;
    return 404;
}

location ~ /(_app|_config|_content|/layouts/) {
    deny all;
    return 404;
}
location ~ /.(yml|yaml|html) { deny all; }

# Return a static file, if it exists, or pass to front controller
location / {
    rewrite ^/admin.php.*$ /admin.php;
    try_files $uri $uri/ /index.php?$args;
}

# Pass PHP requests on to PHP-FPM
location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_pass unix:/run/php5-fpm.sock;
    if (!-f $document_root$fastcgi_script_name) {
            return 404;
    }
    try_files $uri $uri/ /index.php?$args;
    include fastcgi_params;
}

However, when I restart nginx, I get an error:

nginx: [emerg] duplicate location "/" in /etc/nginx-sp/vhosts.d/saweb.d/statamic.conf:23

Line 23 is this line:

location / {

I'm not an nginx hero, but I was hoping the provided config file would just work...

>>>>>>> Unanswered <<<<<<<
2 Replies
3 Followers