Nginx Port-based virtual host:

Source: Internet
Author: User

[Email protected] extra]# cat/etc/nginx/nginx.conf

User Nginx Nginx;

Worker_processes 6;

Error_log/app/log/nginx_error.log Crit;

Pid/app/log/nginx.pid;

Events {

Use Epoll;

Worker_connections 1024;

}

HTTP {

Include Mime.types;

Default_type Application/octet-stream;

Sendfile on;

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/app/log/http.access.log main;

Keepalive_timeout 65;

include/extra/*.conf;

}

[Email protected] extra]#

[email protected] extra]# cat www.conf

server {

Listen 80;

server_name www.etangbo.com;

Access_log/app/log/www/host.access.log main;

Location/{

root/data/www;

Index index.html index.htm;

}

Error_page 502 503 504/50x.html;

Location =/50x.html {

root HTML;

}

}


[email protected] extra]# cat bbs.conf

###

server {

Listen 8081;

server_name bbs.etangbo.com;

Access_log/app/log/bbs/host.access.log main;

Location/{

Root/data/bbs;

Index index.html index.htm;

}

Error_page 502 503 504/50x.html;

Location =/50x.html {

root HTML;

}

}

[email protected] extra]# cat blog.conf

###

server {

Listen 8080;

server_name blog.etangbo.com;

Access_log/app/log/blog/host.access.log main;

Location/{

Root/data/blog;

Index index.html index.htm;

}

Error_page 502 503 504/50x.html;

Location =/50x.html {

root HTML;

}

}

[Email protected] extra]#


################################################

Also can do IP-based virtual host, this is not demonstrated, very simple


This article from "Bobcat" blog, declined reprint!

Nginx Port-based virtual host:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.