The virtual machine I rented from a certain site is about to expire, and the renewal fee is more than 200 yuan. Thinking of buying a new server in Alibaba Cloud, I might as well transfer this one there as well. I will use the real domain name, and please don’t hack my website. Thank you. Alibaba Cloud has deployed a site that can be directly accessed using the domain name www.dcssn.com. My idea is to use www.xhxf119.com to point to this host and access different services based on different domain names. first Domain name resolution must point to the IP address of this host. Then The service of www.dcssn.com opens port 8080, docker run -p 8080:80 weian www.xhxf119.com service opens port 8081, docker run -p 8081:80 xinhua www.dcssn.com:8080 can access www.xhxf119.com:8081 can also access Next, write the nginx configuration file nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.dcssn.com; location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://47.92.69.112:8080; } } server { listen 80; server_name www.xhxf119.com; location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://47.92.69.112:8081; } } } Then save this file to the /host/path/ directory
The general process is like this. You can directly enter www.dcssn.com or www.xhxf119.com to visit Additional knowledge: Docker configures nginx to support multiple subdomains corresponding to different project directories There is a chance to get a reverse proxy distribution For specific PHP and nginx configurations, please see the setup in my blog
The content of the runoob-test-php.conf file is actually the directory corresponding to the subdomain. server { listen 80; server_name www.liuyuanshan.top; location / { #proxy_pass http://106.52.36.65:80; root /usr/share/nginx/html; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name message.liuyuanshan.top; location / { root /usr/share/nginx/html/message/; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/html/message/$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name wordpress.liuyuanshan.top; location / { root /usr/share/nginx/html/wordpress/; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/html/wordpress/$fastcgi_script_name; include fastcgi_params; } } Restart Docker's nginx container
The above article about how to deploy multiple sites on one host using docker nginx is all I have to share with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed steps for using AES.js in Vue
>>: Detailed explanation of MySQL persistent statistics
This article shares the specific code of jQuery t...
Let's first look at the basic syntax of the c...
Based on SEO and security considerations, a 301 r...
Effect: First create five vue interfaces 1.home.v...
Suppose we have n items and we have to sort these...
In many cases, in order to beautify the form, the ...
Preface In current JavaScript, there is no concep...
As a programmer who has just learned Tomcat, this...
Here we introduce the knowledge about form elemen...
Table of contents Problem Description Front-end c...
1. Introduction Oracle has released MySQL 8.0GA. ...
This article uses examples to explain the princip...
Recommended Docker learning materials: https://ww...
Online Preview https://jsrun.pro/AafKp/ First loo...
Linux has been loved by more and more users. Why ...