环境:
nginx 配置目录:/usr/local/nginx/conf/vhost
配置文件内容:
server { listen 80; #listen [::]:80; server_name xxx.xxx.com; index index.html index.htm index.php default.html default.htm default.php; root /xxx/xxx/xxx/xxx; location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1; #rewrite ^/ly/(.*)$ /ly/index.php/$1; } } #location ~ .*.(php|php5)?$ location ~ .php { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; set $path_info ""; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; } location /status { stub_status on; access_log off; } location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*.(js|css)?$ { expires 12h; } access_log /home/wwwlogs/access.log access; }
注意事项:
未经允许不得转载:TacuLee » 修改Nginx支持ThinkPHP