修改 \etc\nginx\conf.d\default.conf
复制之前的server模块一份,重点修改server_name、root、fastcgi_param
如:
- server {
- listen 80;
- server_name exam.baidu.com;
- location / {
- root /var/www/html/exam;
- index index.php index.html index.htm;
- }
- error_page 404 /404.html;
- location = /404.html {
- root /var/www/html;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /var/www/html;
- }
- location ~ \.php$ {
- root /var/www/html/exam;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /var/www/html/exam$fastcgi_script_name;
- include fastcgi_params;
- }
- }
注意还需修改hosts和network
1、修改hosts原文:https://www.cnblogs.com/jpfss/p/9264492.html