简单nginx配置基于域名的虚拟主机
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单nginx配置基于域名的虚拟主机相关的知识,希望对你有一定的参考价值。
user nginx nginx;
worker_processes 8;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#the first virtual host
server {
listen 80;
server_name www.huazhixu.org;
location / {
root html/www;
index index.html index.htm;
}
}
#the second virtual host
server {
listen 80;
server_name blog.huazhixu.org;
location / {
root html/blog;
index index.html index.htm;
}
}
#eht third virtual host
server {
listen 80;
server_name bbs.huazhixu.org;
location / {
root html/bbs;
index index.html index.htm;
}
}
}
本文出自 “花之旭的博客” 博客,请务必保留此出处http://huazhixu123.blog.51cto.com/1591874/1948262
以上是关于简单nginx配置基于域名的虚拟主机的主要内容,如果未能解决你的问题,请参考以下文章