Home >Backend Development >PHP Tutorial >Configure a simple nginx reverse proxy
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.