日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

Nginx 虚拟主机 VirtualHost 配置

發布時間:2025/4/16 Nginx 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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, 修改如下.

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; }


總結

以上是生活随笔為你收集整理的Nginx 虚拟主机 VirtualHost 配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。