lnmp 虚拟主机的配置
在lnmp环境下创建 demo.zhengyang.com。[*]在etc/nginx/ 目录下面创建vhosts文件夹 ,然后在vhosts文件夹里面创demo.zhengyang.com.conf配置文件。
[*]在配置里面放入以下内容:
server {
listen 80;
server_name demo.zhengyang.com;
index index.html index.htm index.php;
root/usr/share/nginx/html/zhengyang;
location ~ \.php$ {
root /usr/share/nginx/html/zhengyang;
fastcgi_pass 127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/usr/share/nginx/html/zhengyang/$fastcgi_script_name;
include fastcgi_params;
}
}
3.我的localhost在 usr/share/nginx/html下,在html目录下面创建zhengyang这个文件夹在文件夹里面创建一个1.php文件
4.在etc/hosts文件下面添加如图所示
页:
[1]