日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Nginx 虚拟主机 VirtualHost 配置

發布時間:2025/4/16 70 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 配置的全部內容,希望文章能夠幫你解決所遇到的問題。

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