Home  >  Article  >  php教程  >  thinkphp nginx configuration

thinkphp nginx configuration

WBOY
WBOYOriginal
2016-08-04 08:56:201195browse

thinkphp的nginx配置
server {<br>     listen       80;<br>     server_name  www.abc.com;<br> <br>     #charset utf-8;<br> <br>     access_log  /var/www/www.abc.com/log/host.access.log;<br>     error_log   /var/www/www.abc.com/log/error.log;<br> <br>     # gzip off;<br> <br>     root        /var/www/www.abc.com/web;<br>     index       index.php index.html index.htm;<br> <br>     location / {<br>         if (!-e $request_filename) {<br>            rewrite  ^/(.*)$  /index.php/$1  last;<br>            break;<br>         }<br>     }<br> <br>     location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {<br>         expires 100d;<br>     }<br>     location ~ .*.(js|css)?$ {<br>         expires 30d;<br>     }<br> <br>     #error_page  404              /404.html;<br> <br>     # redirect server error pages to the static page /50x.html<br>     #<br>     error_page   500 502 503 504  /50x.html;<br>     location = /50x.html {<br>         root   html;<br>     }<br> <br>     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000<br>     #<br>     location ~ .php(/|$) {<br>         fastcgi_pass   127.0.0.1:9000;<br>         fastcgi_index  index.php;<br>         include        fastcgi.conf;<br> <br>         set $fastcgi_script_name2 $fastcgi_script_name;<br>         if ($fastcgi_script_name ~ "^(.+.php)(/.+)$") {<br>             set $fastcgi_script_name2 $1;<br>             set $path_info $2;<br>         }<br>         fastcgi_param   PATH_INFO $path_info;<br>         fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;<br>         fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;<br>     }<br> }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn