Configure a simple nginx reverse proxy

WBOY
Release: 2016-08-08 09:23:29
Original
975 people have browsed it

I am reading the source code of ngx_http_upstream_module recently. First, let the module run, and then debug and trace. Here is an introduction to the nginx reverse proxy with simple configuration.

1. Install httpd

yum install httpd

echo "hello world!" > /var/www/html/index.html

service httpd start

After completing the above steps, you can test it: curl http://127.0.0.1

2. Modify nginx configuration file nginx.conf

server {

Listen 8080; #Because httpd has occupied port 80

location / {

proxy_pass http://127.0.0.1:80;

}

}

3. Test

At this point, nginx’s reverse proxy and upstream modules are ready to run. The test is as follows:

curl http://127.0.0.1:8080

The above introduces the nginx reverse proxy with simple configuration, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!