Last active
September 29, 2021 03:55
-
-
Save jingmian/c658a890509d248340de19fc3059c96c to your computer and use it in GitHub Desktop.
windows下使用TP5的phpstudy-nginx伪静态
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; | |
| server_name www.diaochayun.cn diaochayun.cn; | |
| root "C:/phpStudy/PHPTutorial/WWW/newdiaocha/public"; #把\斜线改为/ | |
| location / { | |
| index index.html index.htm index.php; | |
| #autoindex on; | |
| if (!-e $request_filename) { | |
| rewrite ^(.*)$ /index.php?s=/$1 last; | |
| break; | |
| } | |
| } | |
| 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; | |
| } | |
| #nginx按每个小时生成一个日志文件 | |
| if ($time_iso8601 ~ "(\d{4}-\d{2}-\d{2}T\d{2})") { | |
| set $day $1; | |
| } | |
| access_log /www/wwwlogs/www.xxxx.cn_$day.log main; | |
| } | |
| ============================================== | |
| nginx.conf | |
| ```sh | |
| http{ | |
| # 记录post 信息 用json记录 | |
| log_format main escape=json '$time_local $request $http_x_forwarded_for $document_root $request_body'; | |
| } | |
| ``` | |
| #php.ini添加cgi.fix_pathinfo=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment