本文共 1160 字,大约阅读时间需要 3 分钟。
原文地址:
增加 Nginx 虚拟主机
1. 进入 /usr/local/nginx/conf/目录, 创建虚拟主机配置文件 demo.neoease.com.conf ({域名}.conf).
2. 打开配置文件, 添加服务如下:
log_format demo.neoease.com '$remote_addr - $remote_user [$time_local] $request''$status $body_bytes_sent $http_referer ''$http_user_agent $http_x_forwarded_for';server { listen 80; server_name demo.neoease.com; index index.html index.htm index.php; root /var/www/demo_neoease_com; #access_log /var/log/demo.neoease.com.log demo.neoease.com;}3. 打开 Nginx 配置文件 /usr/local/nginx/conf/nginx.conf, 在 http 范围引入虚拟主机配置文件如下:
include demo.neoease.com.conf;4. 重启 Nginx 服务, 执行以下语句.
service nginx restart
让 Nginx 虚拟主机支持 PHP 在前面第 2 步的虚拟主机服务对应的目录加入对 PHP 的支持, 这里使用的是 FastCGI, 修改如下.
log_format demo.neoease.com '$remote_addr - $remote_user [$time_local] $request''$status $body_bytes_sent $http_referer ''$http_user_agent $http_x_forwarded_for';server { listen 80; server_name demo.neoease.com; index index.html index.htm index.php; root /var/www/demo_neoease_com; location ~ .*\.(php|php5)?$ { fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; } #access_log /var/log/demo.neoease.com.log demo.neoease.com;}
转载地址:http://xjilx.baihongyu.com/