In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to configure multiple virtual hosts vhost in nginx? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
1. Find the configuration file nginx.conf of nginx
Usually in the conf file under the installation path of nginx
Enter the conf directory and see a lot of configuration files
Edit nginx.conf
Add a server {}, and the configuration in each server corresponds to a virtual host vhost
Server {listen 80; / / 80 port server_name linux.com; / / set the domain name # directly enter the directory entered by the domain name and the default parsed file location / {index index.html; root / usr/htdocs/linux / / entering linux.com directly comes here. Generally, the directory where the php is configured and parsed has been} # parsing the .php file location ~\ .php$ {fastcgi_pass 127.0.0.1 location 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / usr/htdocs/linux/$fastcgi_script_name; / / the directory corresponding to the current virtual host include fastcgi_params;}}
Add in nginx.conf
Add the file index.php under the corresponding / usr/htdocs/linux for testing
Restart nginx:service nginx restart
After modifying the configuration file of nginx, you need to restart nginx to take effect.
Open a browser and enter the domain name to test:
This is the answer to the question about how to configure multiple virtual hosts vhost in nginx. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.