Personal home Broadband build multi-domain Web site server configuration

Source: Internet
Author: User

Condition: Household mobile broadband 12M one. Router one. A home PC. Multiple top-level domains.

Requirement: Set up multiple Web sites on your PC.

Software that needs to be installed on your home computer: nat123--Dynamic Domain name resolution.  Wamp Server--PHP parsing. Nginx--Reverse proxy.

Implementation scheme, principle:

1, through the nat123 dynamic Domain name resolution function to resolve the top-level domain name to the dial-up broadband dynamic public network IP (my mobile broadband dial is the public IP, this can be seen in the router)

Implementation steps: Run nat123 software on your PC to add a dynamic domain name resolution record. (Run nat123 software on the computer to add a dynamic domain name resolution, two-level domain name address can be seen, such as: mmfa.01a60a.1.d.cname123.net ). .. Two level domain name address copy good. The second step needs to be used.

2. The domain name CNAME resolves to the level two domain name provided by nat123.

Implementation steps: Domain name registrar there to modify the domain name of the resolution record to the CNAME type, to nat123 provided by the level two domain name

3. The router configures the forwarding rules to forward 80 ports from the top-level domain access request to the 192.168.1.100 80 port on the personal PC.

Implementation steps: Open the 192.168.1.1 Router Management page, forwarding rules---"Virtual Server-" Add a new entry for port 80 to port 80. This means that the domain access request submitted on the Internet user's browser is mapped to a 80-port service on the local 192.168.1.100 computer. Of course, if this machine's Nginx service is not the default port 80, then it will be changed. The service port number is definitely 80 because this is the default port number to open the Web site 80 ... The internal port number is the port number on this machine that provides the service.

4, install and run Nginx, the default is 80 port ...

Implementation steps: Configure the nginx.conf file to add content:

server {
Listen 80;
server_name www.abc.com;
Location/{
Proxy_pass http://127.0.0.1:3000; Default 3000 port for native Nodejs services
}
}

server {
Listen 80;
server_name www.bcd.com;
Location/{
Proxy_pass http://127.0.0.1:8081; Native Apache service listening port, can be arbitrarily modified port number in Apache http.conf file
}
}

Description: A server content is a reverse proxy. Here are 2 reverse proxies. Different domain names go through different channels.

After the Internet, any user in the browser input www.abc.com will open the local Nodejs site page

Browser input www.bcd.com will open the Apache services page.

If the LAN intranet has more than one server, modify 127.0.0.1:8081 to other IP, port number. For example, modified to: 192.168.1.108:80

If you have a domain name like 10, then you need to take care of Apache's multi-domain site configuration. This oneself to Baidu fix.

Alternatively, reverse proxy to a subdirectory directly from a top-level domain: Like what:

server {
Listen 80;
server_name www.ccccc.com;
Location/{
Proxy_pass http://127.0.0.1:8081/phpmyadmin/;
}
}

Or:

server {
Listen 80;
server_name www.ddddd.com;
Location/{
Proxy_pass http://127.0.0.1:8081/a/b/;
}
}

Concluding remarks: This is the first time I've done this. Make it later to write this shared article to the needy friends ... At first I did not install Nginx (although I know nginx can reverse proxy, can do), has been trying to solve the problem through Apache, the results have not been successful for a long time. (according to Baidu above the Apache reverse proxy keyword of the many articles written to do.) )。。 Then just add an nginx ...

Personal home Broadband build multi-domain Web site server configuration

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.