Detailed configuration Phalcon frame Nginx
- Local test environment configuration
server {
listen 8080;
server_name ares.com ;
root "D:\phpstudy\myphp_www\PHPTutorial\WWW\project\aresflare\public";
index index.php index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
server
{
listen 80;
server_name test.zshengt.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/test.zshengt.com/public;
error_page 404 /404.html;
error_page 502 /502.html;
include enable-php-72.conf;
include /www/server/panel/vhost/rewrite/test.zshengt.com.conf;
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log off;
}
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^(.*)$ /index.php?_url=$1;
}
location ~ \.php {
fastcgi_index /index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root /var/www/$host/public;
}
access_log /www/wwwlogs/test.zshengt.com.log;
error_log /www/wwwlogs/test.zshengt.com.error.log;
}