This article introduces how to configure Nginx to rewrite domain names and wildcard domain name resolution, and shares it with you. The details are as follows: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #Set the allowed published content to 8M client_max_body_size 20M; client_body_buffer_size 512k; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X-Requested-With; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; server { listen 80; server_name www.xxx.com; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } server { listen 80; server_name www.aaa.com; location / { proxy_pass http://127.0.0.1:9989; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } #Pan-name resolution server { listen 80; server_name *.web.yuyuyun.cn; location / { # Start configuring wildcard domain name if ( $host ~* (.*)\.(.*)\.(.*)\.(.*) ) { set $domain $1; #Get the current domain name prefix} proxy_pass http://127.0.0.1:1119/$domain/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } } 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:
|
<<: Detailed installation tutorial of mysql 5.7 under CentOS 6 and 7
>>: 4 ways to implement routing transition effects in Vue
1. Text formatting: This example demonstrates how...
The smallest scheduling unit in k8s --- pod In th...
Table of contents 1. Overview 2. Django Project 3...
This article shares the specific code of JavaScri...
NAT In this way, the virtual machine's networ...
1: Differences in speed and loading methods The di...
1 Implementation Principle This is done using the...
Brief review: Browser compatibility issues are of...
The first one: normal operation SELECT SUM(ddd) A...
IE8 new feature Web Slices (Web Slices) Microsoft...
1. Introduction: I think the changes after mysql8...
Table of contents Question: When the button is cl...
Prepare a CentOS6 installation disk (any version)...
Find the problem Recently, when I connected to th...
By default, the width and height of the table are...