Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Creation of Apache and Nginx virtual host

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Apache

(1) based on access host header (FQDN)

Cat / etc/httpd/conf.d/vhostfqdn.conf documentroot / data/web01 servername www.web01.com require all granted CustomLog "logs/a_access_log" combined documentroot / data/web02 servername www.web02.com require all granted CustomLog "logs/a_access_log" combined documentroot / data/web03 Servername www.web03.com require all granted CustomLog "logs/a_access_log" combined

(2) based on ip address

Cat / etc/httpd/conf.d/vhostip.conf documentroot / data/web01 require all granted documentroot / data/web02 require all granted documentroot / data/web03 require all granted

(3) based on port number

Cat / etc/httpd/conf.d/vhostport.conf listen 8001listen 8002listen 8003 documentroot / data/web01 require all granted documentroot / data/web02 require all granted documentroot / data/web03 require all granted

II. Nginx

(1) based on domain name and different sites

Server {listen 80; server_name mobile.magedu.com; location / {root html; index index.html index.htm;} location / python {root / mobile;! The / python directory must be created under the / mobile directory and the files must be written to the python directory, otherwise an error will be reported! Index index.html index.htm;} location / java {root / mobile; index index.html index.htm;}} server {listen 80; server_name www.magedu.com; location / {root html; index index.html index.htm } location / python {root / www; index index.html index.htm;} location / java {root / www; index index.html index.htm;}}

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report