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
When it comes to styling our web pages, we have t...
1. Unzip the mysql compressed package to the /usr...
Installation The required documents are provided ...
The installation tutorial of MySQL 5.7.27 is reco...
1. Introduction MySQL comes with a replication so...
On Linux, bash is adopted as the standard, which ...
<br />Simple example of adding and removing ...
According to null-values, the value of null in My...
Contemporary web visual design has gone through th...
Linux: Linux version 3.10.0-123.9.3.el7.x86_64 Ng...
In order to express the deep condolences of peopl...
Preface Backup is the basis of disaster recovery....
Table of contents 1. Enter the network card confi...
Table of contents 1. Create a sql script file con...
Effect: Ideas: Use the input type attribute to di...