<p>I added a few new lines to conf:</p>

<pre><code>server {
    listen      ip:80;
    server_name example.com www.example.com;
    root        /home/User/web/example.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/example.com.log combined;
    access_log  /var/log/nginx/domains/example.com.bytes bytes;
    error_log   /var/log/nginx/domains/example.com.error.log error;

    location / {
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location / {
            try_files $uri/index.html $uri $uri/ /index.php?$query_string;
        }

        location ~ [^/]\.php(/|$) {
            try_files $uri $uri/ /index.php?$query_string;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9002;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
       }
}

location ~* "/\.(htaccess|htpasswd)$" {
    deny    all;
    return  404;
}

location /vstats/ {
    alias   /home/User/web/example.com/stats/;
    include /home/User/conf/web/example.com.auth*;
}
</code></pre>

CC BY-SA 4.0
2018-07-31T08:28:47.013Z
2018-07-31T08:28:47.013Z
Vitaliy  Badalov
<p>Here's an Nginx config that might help you: <a href="https://github.com/nystudio107/nginx-craft" rel="nofollow noreferrer">Nginx-Craft</a></p>

CC BY-SA 4.0
2018-07-31T16:50:43.220Z
2018-07-31T16:50:43.220Z
andrew.welch
<p>I have php70 with nginx on vestacp. My admin panel work when url <code>example.com/index.php?p=admin/dashboard</code>, but not work <code>example.com/admin/dashboard</code></p>

<p>My nginx conf:</p>

<pre><code>server {
     listen      ip:80;
     server_name example.com www.example.com;
     root        /home/User/web/example.com/public_html;
     index       index.php index.html index.htm;
     access_log  /var/log/nginx/domains/example.com.log combined;
     access_log  /var/log/nginx/domains/example.com.bytes bytes;
     error_log   /var/log/nginx/domains/example.com.error.log error;

     location / {
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9002;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
     }
}

location ~* "/\.(htaccess|htpasswd)$" {
    deny    all;
    return  404;
}

location /vstats/ {
    alias   /home/User/web/example.com/stats/;
    include /home/User/conf/web/example.com.auth*;
}

include     /etc/nginx/conf.d/phpmyadmin.inc*;
include     /etc/nginx/conf.d/phppgadmin.inc*;
include     /etc/nginx/conf.d/webmail.inc*;

include     /home/User/conf/web/nginx.example.com.conf*;
</code></pre>

<p>}</p>

<nginx>
nginx conf for craft
# nginx conf for craft

(Asked by: username_0 on 2018-07-31)

I have php70 with nginx on vestacp. My admin panel work when url example.com/index.php?p=admin/dashboard, but not work example.com/admin/dashboard
My nginx conf:
server {
     listen      ip:80;
     server_name example.com www.example.com;
     root        /home/User/web/example.com/public_html;
     index       index.php index.html index.htm;
     access_log  /var/log/nginx/domains/example.com.log combined;
     access_log  /var/log/nginx/domains/example.com.bytes bytes;
     error_log   /var/log/nginx/domains/example.com.error.log error;

     location / {
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9002;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
     }
}

location ~* "/\.(htaccess|htpasswd)$" {
    deny    all;
    return  404;
}

location /vstats/ {
    alias   /home/User/web/example.com/stats/;
    include /home/User/conf/web/example.com.auth*;
}

include     /etc/nginx/conf.d/phpmyadmin.inc*;
include     /etc/nginx/conf.d/phppgadmin.inc*;
include     /etc/nginx/conf.d/webmail.inc*;

include     /home/User/conf/web/nginx.example.com.conf*;

}

**Tags:** nginx


---

## 2 answers

### Answer by username_0 on 2018-07-31. Score: 1

I added a few new lines to conf:
server {
    listen      ip:80;
    server_name example.com www.example.com;
    root        /home/User/web/example.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/example.com.log combined;
    access_log  /var/log/nginx/domains/example.com.bytes bytes;
    error_log   /var/log/nginx/domains/example.com.error.log error;

    location / {
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location / {
            try_files $uri/index.html $uri $uri/ /index.php?$query_string;
        }

        location ~ [^/]\.php(/|$) {
            try_files $uri $uri/ /index.php?$query_string;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9002;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
       }
}

location ~* "/\.(htaccess|htpasswd)$" {
    deny    all;
    return  404;
}

location /vstats/ {
    alias   /home/User/web/example.com/stats/;
    include /home/User/conf/web/example.com.auth*;
}


---

### Answer by username_1 on 2018-07-31. Score: 0

Here's an Nginx config that might help you: [Nginx-Craft](https://github.com/nystudio107/nginx-craft)


---

