In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
To deploy multiple sites on a server, you need to open multiple ports to access different sites. The process is very simple. It took 2 hours to debug. Record:
Main domain name multi-port access
Set A record in DNS NameServer
Point the www.xxx.com to the server ip
Open the required port and modify the nginx configuration file
For example, we have two services open on port 80 and port 8080 respectively.
If there is an iptable, open the port first:
Iptables-An INPUT-ptcp-- dport 80-j ACCEPTiptables-An INPUT-ptcp-- dport 8080-j ACCEPT
Modify the configuration file:
# path: / usr/local/nginx/conf/nginx.confserver {listen 80 / serverSecretname www.xxx.com;access_log / data/www/log/33.33.33.33_nginx.log combined;index index.html index.htm index.php;include / usr/local/nginx/conf/rewrite/none.conf;root / data/www/website/33.33.33.33:80;location ~ [^ /]\ .php (/ | $) {fastcgi_pass unix:/dev/shm/php-cgi.sock Fastcgi_index index.php;include fastcgi.conf;} location ~. *\. (gif | jpg | jpeg | png | bmp | swf | flv | ico) ${expires 30d; access_log off;} location ~. *\. (js | css)? ${expires 7d; access_log off;}} server {listen 8080 / serverroomname A.xxx.com accessorial log / data/www/log/33.33.33.33:8080_nginx.log combined;index index.html index.htm index.php;include / usr/local/nginx/conf/rewrite/none.conf Root / data/www/website/33.33.33.33:8080;location ~ [^ /]\ .php (/ | $) {fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf;} location. *\. (gif | jpg | jpeg | png | bmp | swf | flv | ico) ${expires 30d; access_log off;} location ~. *\. (js | css)? ${expires 7d; access_log off;}}
The key is the configuration of two server segments. You can also split the two segments into two configuration files and put them in the
/ etc/nginx/conf.d/
Under the directory
Sub-domain name multi-port access
This kind of access is silly because your access to port 8080 requires a format like http://xxx.com:8080.
And what if there are two different cgi, for example, port 80 corresponds to a php web service, port 8080 corresponds to a nodejs web service, and our nodejs comes with a web service, which is already listening on port 8080?
At this time, we need the reverse proxy function of Nginx, and add an A record to DNS Server, and finally implement
Www.xxx.com accesses port 80 A.xxx.com accesses port 8080 service through nginx forwarding
Add an A record
Point the A.xxx.com to the server ip
The Nginx configuration template is as follows:
# path: / usr/local/nginx/conf/nginx.confserver {listen 80; server_name www.xxx.com; access_log / data/www/log/33.33.33.33_nginx.log combined; index index.html index.htm index.php; include / usr/local/nginx/conf/rewrite/none.conf; root / data/www/website/33.33.33.33:80 Location ~ [^ /]\ .php (/ | $) {fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf;} location. *\. (gif | jpg | jpeg | png | bmp | swf | flv | ico) ${expires 30d; access_log off;} location ~. *\. (js | css)? ${expires 7d; access_log off;}} server {listen 80; listen [:]: 80 Server_name A.XXX.com; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; fastcgi_send_timeout 300s; fastcgi_read_timeout 300s; location / {proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade Try_files $uri $uri/ = 404;}}
Nginx reloads the configuration file
Nginx-s reload
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.