Nginx本地配置域名

1/hosts文件加入指向

2/nginx/conf目录下  vhost添加内容

server {
listen 80;
# listen [::]:80 default_server;
expires -1;
root "E:/php/erp/public"; #网站根目录
index index.php index.html index.htm;

server_name member.fx.com; #网站域名

location / {
try_files $uri $uri/ /index.php?$query_string; # laravel要配置这行,其他框架稍有不同
}

location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}

#location ~ .*/\.(css|js)$ { add_header Cache-Control 'no-store'; }

}

发表评论

电子邮件地址不会被公开。

This site uses Akismet to reduce spam. Learn how your comment data is processed.