How to realize Nginx domain name forwarding

12-19-2023

Nginx introduction

Nginx(engine x) is a high-performance web and reverse proxy server developed by igor sysoev, a Russian programmer. It is also an imap/pop3/smtp proxy server. Nginx is a good substitute for apache server in the case of high connection concurrency.

Nginx installation

1. Install compilation tools and library files.

yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel

2. Install pcre

Download the cd installation directory of the unzipped source package by yourself. /configure make && make install// Compile and install.

Step 3 install nginx

Download the cd installation directory of the unzipped source package by yourself. /configuremakemake install

Nginx common commands

# # # Start nginx./nginx## Close nginx./nginx -s stop## Reload the configuration file. /nginx -s reload.

Domain name forwarding configuration

The following is my configuration file. I only configured a simple domain name forwarding function, and I didn't use other functions of nginx. nginx is extremely powerful, and domain name forwarding is just the tip of the iceberg.

## nginx/conf/nginx.confworker_processes 1; events { worker_connections 1024; }http { include mime.types; default_type application/octet-stream; sendfile on; server { listen 80; server_name www.fbm.com ; location / { root html; index index.html index.htm ; proxy_pass http://localhost:8080; } } server { listen 80; server_name fmp.hzfh.com ; location / { proxy_pass http://fmp.hzfh.com ; } }}

Note: Don't forget to open the port on the firewall.

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us