In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How to bind a domain name in apache? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Apache binds domain name
What should you do if you want the domain name resolution of your online project to be your local IP? Do you have to change the configuration files one by one?
Example: the domain name is aaa.com
The port defaults to 80.
I tried to change it to port 8080, but something went wrong
1. Local hosts
What is a local hosts? We know how to access a domain name, get the ip address of the server that the domain name points to through the dns server, and then establish a connection with the server through the ip address to do the rest. So how can we simulate a domain name when we don't have a domain name in the development process? The answer is the hosts file
Address: C:\ Windows\ System32\ Drivers\ etc\ hosts open it in notepad and add a line at the end:
127.0.0.1 localhost aaa.com
2.apache virtual host configuration
Suppose apache is installed in x:\ apache, then open x:\ apache\ conf\ httpd.conf first, and look for "Include conf/extra/httpd-vhosts.conf". If it is deleted by'#', if there is no such statement, add it manually.
Then go to the directory where you installed Apache for example: d:\ xampp\ apache\ conf\ extra directory to find or create a new httpd-vhosts.conf file (if the domain name you want to resolve is http protocol, modify here, if HTTPS protocol, modify httpd-ssl.conf file)
After opening the file, add at the end:
ServerAdmin webmaster@dummy-host.localhost DocumentRoot "D:/EmpireServer/web" ServerName localhost ServerAlias localhost ErrorLog "logs/localhost-error_log" ServerAdmin webmaster@dummy-host.localhost DocumentRoot "D:/EmpireServer/web" You correspond to the code location of the parsed domain name) ServerName aaa.com (here is the same address as you wrote in the hosts file) ServerAlias *. Aaa.com (identify the domain name generated by resolution) ErrorLog "logs/localhost-error_log"
When the virtual hosting feature is enabled, all requests will enter, and the first will be the default processing configuration, that is, www.aaa.com will enter the second
Others that do not match will enter the first configuration, such as the localhost series.
3. Open port 80
The port must be open.
And here I didn't test whether the resolution of apache is valid because the server resolves the domain name.
After reading the above, do you know how to bind a domain name in apache? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.