1、新建一个伪静态文件,按NGINX的规则配置好每一条;

2、在NGINX安装环境下的conf->vhosts下新建一个域名_端口号.conf(www.xxxx.com_80.conf)文件,配置相关信息;可使用集成环境自动生成;线上修改服务器对应的NGINX配置文件
server {
listen 80; #端口
server_name www.haha.com; #域名
root "D:/www2020/other/hahahuodong"; #根目录
location / { #规则
index index.php index.html error/index.html; #默认入口文件
error_page 400 /error/400.html; #错误跳转链接#
error_page 403 /error/403.html;
error_page 404 /404.html;
error_page 500 /error/500.html;
error_page 501 /error/501.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
error_page 504 /error/504.html;
error_page 505 /error/505.html;
error_page 506 /error/506.html;
error_page 507 /error/507.html;
error_page 509 /error/509.html;
error_page 510 /error/510.html;
include D:/www2020/other/hahahuodong/nginx.htaccess; #引入伪静态文件
autoindex off;#通过域名访问文件夹
}
location ~ .php(.*)$ {
fastcgi_pass unix:/tmp/php-cgi.sock; #进程通信方式通信sockets(效率更高)
#fastcgi_pass 127.0.0.1:9000; #进程通信方式通信tcp
#群集方式传递
#upstream cloud{
#server cgi_1.cloud.com;
#server cgi_2.cloud.com;
#}
#fastcgi_pass cloud;
fastcgi_index index.php; #若请求的URL以/结尾,则会自动追加上index.php (fastcgi_index的值index.php会存在$fastcgi_script_name变量中)
fastcgi_split_path_info ^((?U).+.php)(/?.+)$; #Nginx默认获取不到PATH_INFO的值,得通过fastcgi_split_path_info指定定义的正则表达式来给$fastcgi_path_info赋值
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #配置置统一入口文件
fastcgi_param PATH_INFO $fastcgi_path_info; #PATH_INFO是一个CGI 1.1的标准,经常用来做为传参载体.
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; #当前 脚本所在文件系统(不是文档根目录)的基本路径
include fastcgi_params;
}
}
3、保存重启服务器




网站建设
品牌设计
APP开发
小程序开发
商城开发
网站优化
UI设计
增值服务