首页 > 代码库 > Nginx 配置基于域名的虚拟
Nginx 配置基于域名的虚拟
编辑配置文件
vi /etc/nginx/nginx.conf
user www www;
worker_processes 2;
error_log logs/error.log notice;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr -$remote_user [$time_local] "$request" ‘
‘$status $body_bytes_sent "$http_referer" ‘
‘"$http_user_agent" "$http_x_forwarded_for"‘;
access_log /data/logs/www-logs/http/access.log main;
sendfile on;
keepalive_timeout 65;
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
gzip on;
#虚拟主机1
server { listen 80; server_name www.site1.com; access_log /data/logs/www-logs/www.site1.com/host.access.log main; location / { root /data/web/www.site1.com/htdocs; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
#虚拟主机2
server { listen 80; server_name www.site2.com; access_log /data/logs/www-logs/www.site2.com/host.access.log main; location / { root /data/web/www.site2.com/htdocs; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
#虚拟主机3
server { listen 80; server_name www.site3.com; access_log /data/logs/www-logs/www.site3.com/host.access.log main; location / { root /data/web/www.site3.com/htdocs; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }}
Nginx 配置基于域名的虚拟
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。