Nginx 虚拟主机 VirtualHost 配置
生活随笔
收集整理的這篇文章主要介紹了
Nginx 虚拟主机 VirtualHost 配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原文地址:?http://www.neoease.com/nginx-virtual-host/
增加 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, 修改如下.
總結
以上是生活随笔為你收集整理的Nginx 虚拟主机 VirtualHost 配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux c/c++
- 下一篇: 记录自定义的代码片段位置