时间:2023-01-31 14:32:01 | 来源:建站知识
时间:2023-01-31 14:32:01 来源:建站知识
接上篇文章find / -name nginx.conf
2 打开这个目录。vim /etc/nginx/nginx.conf
插入以下# 包含所有的虚拟主机的配置文件include /etc/nginx/vhosts/*.conf;
保存退出mkdir /etc/nginx/vhosts
4 创建名字为 www.test.com.conf 文件。并复制以下内容进去server { listen 80; server_name www.test.com; location / { root /usr/share/nginx/html/www.test.com/; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html/www.test.com; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/www.test.com/$fastcgi_script_name; include fastcgi_params; } location ~ /.ht { deny all; }}
service nginx restart
<?phpecho "test";?>
关键词: