Debian and Ubuntu both come with Nginx and use them to configure the reverse proxy of Nginx, which is very convenient. Install Nginx and run the following command to install and run Nginxapt-getinstallnginx/etc/init. d/nginxstart and access port 80 of the IP address in the browser. the & quot; WelcometoNgin Debian and Ubuntu both come with Nginx and use them to configure the Nginx Reverse proxy, very convenient.
Install Nginx
Run the following command to install and run Nginx
Apt-get install nginx
/Etc/init. d/nginx start
Then access port 80 of the IP address in the browser and you will see "Welcome to Nginx! ", Which indicates Nginx installation is complete!
Configure Nginx for reverse proxy
The default site configuration file for Nginx is/etc/nginx/sites-available/default. modify the following parts of this file:
Location /{
Root/var/www/nginx-default;
Index index.html index.htm;
}
Then re-access port 80 on the IP address in the browser. the google homepage is displayed, and the reverse proxy configuration is successful.
Multi-domain reverse proxy configuration instance
Configure a reverse proxy for multiple domain names on one VPS. for example, we have two domain names: test1.idcfree.com and test2.idcfree.com. we want the user to access test1.idcfree.com to view the content of www.linuxidc.com, if you want to see www.baidu.org.tw when you access test2.idcfree.com, you only know the existence of test1.idcfree.com and test2.idcfree.com, but do not know the existence of www.linuxidc.com and www.baidu.org.tw.
First, you need to direct the domain names test1.idcfree.com and test2.idcfree.com to the vps ip address.
Then add two files in the/etc/nginx/sites-available directory named test1.idcfree.com and test2.idcfree.com.
The content of the test1.idcfree.com file is as follows:
Server {
Listen 80;
Server_name test1.idcfree.com;
When you access test1.idcfree.com in your browser, the content of www.linuxidc.com will appear. when you access test2.idcfree.com, the content of www.baidu.org.tw will appear.
Advanced Configuration of reverse proxy
For some advanced configurations of Nginx Reverse proxy, we will continue to write blog introduction, so stay tuned.
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.