Apache HTTPServer(abbreviationApache) isApache Software Foundation an open source Web server, which can run in most computer operating systems, is one of the most popular web server-side software due to its multi-platform and security being widely used.
The construction of Apache server under Linux
Install and update Apache
Yum Install httpd
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/95/wKiom1UMKu3jKjqLAAB77u9EAYQ758.jpg "title=" Picture 1.png "alt=" Wkiom1umku3jkjqlaab77u9eayq758.jpg "/>
Start the service
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/8F/wKioL1UMLDfBRMk9AABtAJQPuSA234.jpg "title=" Picture 2.png "alt=" Wkiol1umldfbrmk9aabtajqpusa234.jpg "/>
Apache stores Web pages in/var/www/html by default
Create a new index.html page in this directory
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/95/wKiom1UMKzDi6B39AAB0M_RoB-E354.jpg "title=" Picture 3.png "alt=" Wkiom1umkzdi6b39aab0m_rob-e354.jpg "/>
Edit HTML file
At this point in the client browser input server address, simple build complete!
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/8F/wKioL1UMLIDTrwMfAABQfMLCx9g380.jpg "title=" Picture 4.png "alt=" Wkiol1umlidtrwmfaabqfmlcx9g380.jpg "/>
Apache's main configuration file/etc/httpd/conf/httpd.conf
httpd Default Listener 80 port
Apache Virtualhost is to run multiple Web sites on a single server, each virtual host can be bound to separate domain names, for these domain names can specify a separate directory, access to these domain names, Apache will open the corresponding directory in the contents. To configure Apache's virtual host, you only need to modify the Apache configuration file.
There are two modes of Apache
1. Center Host
2, virtual host three (need to shut down the central host comment off # documentroot "/var/www/html"):
① based on IP
Add an IP address to a host
[[Email protected] home]# IP addr add 192.168.157.140/24 dev eth0
View, add complete
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/95/wKiom1UMK9SStUHRAAHuswFFnSg232.jpg "title=" Picture 5.png "alt=" Wkiom1umk9sstuhraahuswffnsg232.jpg "/>
In the/home directory, add the specified site directory, under which the. html file is created.
Mkdir/home/website1
Mkdir/home/website2
Edit httpd.conf
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/8F/wKioL1UMLRiSVdO5AABuSISfNyk868.jpg "title=" Picture 6.png "alt=" Wkiol1umlrisvdo5aabusisfnyk868.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/95/wKiom1UMLAWiL9FkAADhEF2KKVI568.jpg "title=" Picture 7.png "alt=" Wkiom1umlawil9fkaadhef2kkvi568.jpg "/>
Use command httpd-t to check syntax for errors after configuration is complete
Restart Service
Testing under Windows
(Note that you need to close SELinux Setenforce 0 before testing)
Otherwise, the following error will occur
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/95/wKiom1UMMFeBElMDAAElHxcU3kw640.jpg "title=" Picture 18.png "alt=" Wkiom1ummfebelmdaaelhxcu3kw640.jpg "/>
The normal results are as follows
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/8F/wKioL1UMLaaxHJd7AABzLc8RAeU695.jpg "title=" Picture 8.png "alt=" Wkiol1umlaaxhjd7aabzlc8raeu695.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/95/wKiom1UMLJqgCLvZAAB-4XkpDvs049.jpg "title=" Picture 9.png "alt=" Wkiom1umljqgclvzaab-4xkpdvs049.jpg "/>
② Domain-based
Editing a configuration file
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/8F/wKioL1UMLf-jH-d0AABaIp13yv0682.jpg "style=" float: none; "title=" Image 10.png "alt=" Wkiol1umlf-jh-d0aabaip13yv0682.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/95/wKiom1UMLNaABEgcAAFj3Ii_uZY728.jpg "style=" float: none; "title=" Image 11.png "alt=" Wkiom1umlnaabegcaafj3ii_uzy728.jpg "/>
Edit the host file for Windows to add records in C:\Windows\System32\drivers\etc\hosts
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5B/8F/wKioL1UMLmzBvhj0AADqo2YFINI570.jpg "style=" float: none; "title=" Image 12.png "alt=" Wkiol1umlmzbvhj0aadqo2yfini570.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5B/95/wKiom1UMLUDTJxI4AAI43fWbySk398.jpg "style=" float: none; "title=" Image 13.png "alt=" Wkiom1umludtjxi4aai43fwbysk398.jpg "/>
Parse success
Access the domain name, such as, success!
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/8F/wKioL1UML2LQ5cM0AABnRC5UCHI871.jpg "style=" float: none; "title=" Image 14.png "alt=" Wkiol1uml2lq5cm0aabnrc5uchi871.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/95/wKiom1UMLjahNMerAABobh8WpqE840.jpg "style=" float: none; "title=" Image 15.png "alt=" Wkiom1umljahnmeraabobh8wpqe840.jpg "/>
③ Port-based
Open a specific port for the site first
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/8F/wKioL1UML5PDagQ4AABULEjsK1c337.jpg "title=" Picture 16.png "alt=" Wkiol1uml5pdagq4aabulejsk1c337.jpg "/>
Comment out DocumentRoot
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/95/wKiom1UML0OgV0Q_AACPwduFAE4494.jpg "title=" Picture 17.png "alt=" Wkiom1uml0ogv0q_aacpwdufae4494.jpg "/>
Add VirtualHost
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/95/wKiom1UML4PBpg-aAADu8vHqeM8908.jpg "title=" Picture 1.png "alt=" Wkiom1uml4pbpg-aaadu8vhqem8908.jpg "/>
Restart the service, test under Windows
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/8F/wKioL1UMMd-h4_YQAAB7n9qsyuA825.jpg "style=" float: none; "title=" Image 19.png "alt=" Wkiol1ummd-h4_yqaab7n9qsyua825.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/95/wKiom1UMMMXxROWoAACMDpEXvl4402.jpg "style=" float: none; "title=" Image 20.png "alt=" Wkiom1ummmxxrowoaacmdpexvl4402.jpg "/>
At this point Apache three simple virtual host configuration is complete.
This article is from the "Filter New" blog, please be sure to keep this source http://wahehe.blog.51cto.com/8935316/1622680
Configuration of Apache build and virtual host under Linux