Implementation of Nginx domain name forwarding

Implementation of Nginx domain name forwarding

Introduction to Nginx

Nginx ("engine x") is a high-performance Web and reverse proxy server developed by Russian programmer Igor Sysoev. It is also an IMAP/POP3/SMTP proxy server. In the case of high connection concurrency, Nginx is a good alternative to Apache server.

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 and unzip the source package cd installation directory ./configure 
make && make install //Compile and install

3. Install Nginx

Download and unzip the source package cd installation directory ./configure
make
make install

Nginx Common Commands

### In the nginx/sbin directory###

## Start nginx
./nginx

## Shut down nginx
./nginx -s stop

## Reload the configuration file./nginx -s reload

Domain forwarding configuration

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

## nginx/conf/nginx.conf

worker_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 your firewall.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to set Nginx to forward the domain name to the specified port
  • Using nginx forward proxy to implement intranet domain name forwarding process analysis
  • Nginx reverse proxy is used for intranet domain name forwarding
  • Implementation of HTTP and HTTPS services with Nginx reverse proxy for multiple domain names
  • Use nginx + secondary domain name + https support
  • Nginx defines domain name access method
  • nginx+tomcat example of accessing the project through the domain name
  • Nginx domain forwarding usage scenario code example

<<:  Solution to forgetting mysql password under linux

>>:  How to implement the jQuery carousel function

Recommend

How to install and configure SSH service in Ubuntu 18.04

Install ssh tool 1. Open the terminal and type th...

The latest MySQL 5.7.23 installation and configuration graphic tutorial

The detailed installation and configuration of th...

Vue recursively implements three-level menu

This article example shares the specific code of ...

Vue state management: using Pinia instead of Vuex

Table of contents 1. What is Pinia? 2. Pinia is e...

Some notes on mysql create routine permissions

1. If the user has the create routine permission,...

Example of how to configure nginx in centos server

Download the secure terminal MobaXterm_Personal F...

How to solve the slow speed of MySQL Like fuzzy query

Question: Although the index has been created, wh...

MySQL NULL data conversion method (must read)

When using MySQL to query the database and execut...

How to track users with JS

Table of contents 1. Synchronous AJAX 2. Asynchro...

How to create, start, and stop a Docker container

1. A container is an independently running applic...

Example code for implementing triangles and arrows through CSS borders

1. CSS Box Model The box includes: margin, border...

How to implement logic reuse with Vue3 composition API

Composition API implements logic reuse steps: Ext...

Summary of essential knowledge points for MySQL query optimization

Preface Query optimization is not something that ...

Vue3 encapsulates its own paging component

This article example shares the specific code of ...