以上就是给各位分享thinkphp5nginx.conf配置,其中也会对thinkphp6nginx进行解释,同时本文还将给你拓展003.thinkPHP-nginx部署-nginx.conf文件配置
以上就是给各位分享thinkphp5 nginx.conf 配置,其中也会对thinkphp6 nginx进行解释,同时本文还将给你拓展003.thinkPHP-nginx部署-nginx.conf文件配置、HomeStead Nginx 配置 ThinkPHP5、LNMP 配置NGINX 支持THINKPHP PATHINFO模式、lnmp一键包的thinkphp5 nginx配置分享等相关知识,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:- thinkphp5 nginx.conf 配置(thinkphp6 nginx)
- 003.thinkPHP-nginx部署-nginx.conf文件配置
- HomeStead Nginx 配置 ThinkPHP5
- LNMP 配置NGINX 支持THINKPHP PATHINFO模式
- lnmp一键包的thinkphp5 nginx配置分享
thinkphp5 nginx.conf 配置(thinkphp6 nginx)
thinkPHP5 Nginx.conf 配置
server { listen 80;
#域名 server_name youzuoapi.osd-asia.com; index index.PHP index.html index.htm default.PHP default.htm default.html;
#项目目录 root /www/web/youzuo/public; location / { if ( -f $request_filename) { break; } if ( !-e $request_filename) { rewrite ^/(.*)$ /index.PHP/$1 last; break; } } #后台重写规则 location /admin/ { if ( !-e $request_filename) { rewrite ^/admin/(.*)$ /admin/index.PHP/$1 last; break; } } location ~ \.PHP { set $script $uri; set $path_info ""; if ($uri ~ "^(.+\.PHP)(/.+)") { set $script $1; set $path_info $2; } include fastcgi_params; fastcgi_index index.PHP; fastcgi_pass 127.0.0.1:9000; fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_FILENAME $document_root$script; fastcgi_param SCRIPT_NAME $script; try_files $uri =404; } access_log /www/source/Nginx/logs/www_access.log; error_log /www/source/Nginx/logs/error.log error; }
003.thinkPHP-nginx部署-nginx.conf文件配置
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/Nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; root /usr/local/Nginx/html/threeholePHP; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; if (!-e $request_filename){ rewrite ^/(.*)$ /index.PHP?s=$1 last; } } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.PHP$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.PHP$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.PHP; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with Nginx's one # #location ~ /\.ht { # deny all; #} location ~ \.PHP { #root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_split_path_info ^(.+\.PHP)(.*)$; #fastcgi_param PATH_INFO $fastcgi_path_info; #include fastcgi_params; #加载Nginx默认"服务器环境变量"配置 include fastcgi.conf; #设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量 set $fastcgi_script_name2 $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+\.PHP)(/.+)$") { set $fastcgi_script_name2 $1; set $path_info $2; } fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2; fastcgi_param SCRIPT_NAME $fastcgi_script_name2; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server server { listen 443 ssl; #配置HTTPS的默认访问端口为443。 #如果未在此处配置HTTPS的默认访问端口,可能会造成Nginx无法启动。 #如果您使用Nginx 1.15.0及以上版本,请使用listen 443 ssl代替listen 443和ssl on。 server_name www.lognet.top; #需要将yourdomain.com替换成证书绑定的域名。 root html; index index.html index.htm; ssl_certificate cert/5019243_www.lognet.top.pem; #需要将cert-file-name.pem替换成已上传的证书文件的名称。 ssl_certificate_key cert/5019243_www.lognet.top.key; #需要将cert-file-name.key替换成已上传的证书密钥文件的名称。 ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #表示使用的加密套件的类型。 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #表示使用的TLS协议的类型。 ssl_prefer_server_ciphers on; location / { root html; #站点目录。 index index.html index.htm; } } }
Nginx重启
ps -ef|grep Nginx kill -9 30297 cd /usr/local/Nginx/sbin/ ./NginxHomeStead Nginx 配置 ThinkPHP5
在 Lavarel 社区提供的 HomeStead 盒子上配置 ThinkPHP5.0 项目。
Nginx 配置:nginx 1.11.9
PHP 版本:php7.1
配置代码
server {
listen 80;
server_name cms.laifuzi.com; //项目域名
access_log /var/log/nginx/thinkcms_access.log; //日志文件
error_log /var/log/nginx/thinkcms_access.log;
set $root ''/home/vagrant/php_workspace/thinkcms/public''; //项目根目录
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}
root $root;
index index.php index.html index.htm;
location @rewrite {
rewrite ^(.*)$ index.php/$1 last;
}
location /{
if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last; //这里用TP官文档里的写法
break;
}
}
location ~ \.php {
root $root;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
include fastcgi_params;
}
}
参考:
https://www.kancloud.cn/manual/thinkphp5_1/353955
https://blog.csdn.net/panxiong91/article/details/52434910
LNMP 配置NGINX 支持THINKPHP PATHINFO模式
在支付宝回调,和微信回调方法中。正常不支持参数中带 ?s= ,所以要开启
THINKPHP 官方论坛 和网络上很多NGINX配置教程不是太完善的。
我一直比较喜欢使用lnmp.org配置服务器环境。
所以本文将介绍 LNMP 配置NGINX 支持THINKPHP PATHINFO模式 。
方法很简单 。
立即学习“PHP免费学习笔记(深入)”;
1,修改PHP.INI 支持 PHPINOF
PHP配置文件:/usr/local/php/etc/php.ini
更改php.ini
找到:cgi.fix_pathinfo=0
更改为:cgi.fix_pathinfo=1
2.修改
/usr/local/nginx/conf/vhost/你的域名配置文件
去掉include pathinfo的#,在try_files前加#;
3.重启lnmp即可。
lnmp restart
转载,原文地址:http://my.oschina.net/caomenglong/blog/660529
'').addClass(''pre-numbering'').hide(); $(this).addClass(''has-numbering'').parent().append($numbering); for (i = 1; i '').text(i)); }; $numbering.fadeIn(1700); }); });以上就介绍了 LNMP 配置NGINX 支持THINKPHP PATHINFO模式,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
lnmp一键包的thinkphp5 nginx配置分享
server { listen 80 default_server; #listen [::]:80 default_server ipv6only=on; server_name _; index index.html index.htm index.php; root /home/wwwroot/default; #error_page 404 /404.html; # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*.php$ { deny all; }
location /
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
if (!-d $request_filename){
set $rule_0 1$rule_0;
}
if (!-f $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/(.*)$ /index.php/$1 last;
}
include pathinfo.conf;
}
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/access.log;
}
今天的关于thinkphp5 nginx.conf 配置和thinkphp6 nginx的分享已经结束,谢谢您的关注,如果想了解更多关于003.thinkPHP-nginx部署-nginx.conf文件配置、HomeStead Nginx 配置 ThinkPHP5、LNMP 配置NGINX 支持THINKPHP PATHINFO模式、lnmp一键包的thinkphp5 nginx配置分享的相关知识,请在本站进行查询。
本文标签: