catalog

Apache Installation of services
<https://blog.csdn.net/qq_36119192/article/details/82768277#Apache%E6%9C%8D%E5%8A%A1%E7%9A%84%E9%83%A8%E7%BD%B2%EF%BC%9A>

yum Source installation :
<https://blog.csdn.net/qq_36119192/article/details/82768277#yum%E6%BA%90%E5%AE%89%E8%A3%85%EF%BC%9A>

Catalog file
<https://blog.csdn.net/qq_36119192/article/details/82768277#%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6>

Source package installation :
<https://blog.csdn.net/qq_36119192/article/details/82768277#%E6%BA%90%E7%A0%81%E5%8C%85%E5%AE%89%E8%A3%85%EF%BC%9A>

Catalog file :
<https://blog.csdn.net/qq_36119192/article/details/82768277#%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6%EF%BC%9A>

Apache Add a pair of php Support for
<https://blog.csdn.net/qq_36119192/article/details/82768277#Apache%E4%B8%AD%E6%B7%BB%E5%8A%A0%E5%AF%B9php%E7%9A%84%E6%94%AF%E6%8C%81>

Apache Add php Yes mysql Database support
<https://blog.csdn.net/qq_36119192/article/details/82768277#Apache%E4%B8%AD%E6%B7%BB%E5%8A%A0php%E5%AF%B9mysql%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E6%94%AF%E6%8C%81>

Apache Advanced configuration of services
<https://blog.csdn.net/qq_36119192/article/details/82768277#Apache%E6%9C%8D%E5%8A%A1%E7%9A%84%E9%AB%98%E7%BA%A7%E9%85%8D%E7%BD%AE>

1: Configuration based on ip Virtual host for
<https://blog.csdn.net/qq_36119192/article/details/82768277#1%EF%BC%9A%E9%85%8D%E7%BD%AE%E5%9F%BA%E4%BA%8Eip%E7%9A%84%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BA>

2. Configure port based virtual hosts
<https://blog.csdn.net/qq_36119192/article/details/82768277#2.%20%E9%85%8D%E7%BD%AE%E5%9F%BA%E4%BA%8E%E7%AB%AF%E5%8F%A3%E7%9A%84%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BA>

3. Configure domain based virtual hosts
<https://blog.csdn.net/qq_36119192/article/details/82768277#3.%E9%85%8D%E7%BD%AE%E5%9F%BA%E4%BA%8E%E5%9F%9F%E5%90%8D%E7%9A%84%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BA>

HTTP Access control of services
<https://blog.csdn.net/qq_36119192/article/details/82768277#HTTP%E6%9C%8D%E5%8A%A1%E7%9A%84%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6>

be based on ip Configuration of user access control for :
<https://blog.csdn.net/qq_36119192/article/details/82768277#%E5%9F%BA%E4%BA%8Eip%E7%9A%84%E7%94%A8%E6%88%B7%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6%E7%9A%84%E9%85%8D%E7%BD%AE%EF%BC%9A>

Configuration of authorization based on user identity authentication :
<https://blog.csdn.net/qq_36119192/article/details/82768277#%E5%9F%BA%E4%BA%8E%E7%94%A8%E6%88%B7%E8%BA%AB%E4%BB%BD%E8%AE%A4%E8%AF%81%E6%8E%88%E6%9D%83%E7%9A%84%E9%85%8D%E7%BD%AE%EF%BC%9A>

Apache 
It's the number one user in the world Web Server software . It can run on almost all widely used computer platforms , Because of its cross platform and security, it is widely used , It's the most popular Web One of the server side software . It's fast , It's reliable and easy to use API expansion , take Perl/Python Wait for the parser to compile into the server . however Apache One drawback is that , A restart is required to reload the configuration file  httpd  service , and nginx When you overload a configuration file, you only need to overload it reload Configuration file is enough .httpd Service default listening  
tcp / 80  port

apache There are two log files ,access.log Log the visit to the website ;error.log An error log was recorded

Apache Installation of services

yum Source installation :

* install httpd main program :  yum  -y  install  httpd
* stay /var/www/html Directory to write our own home page  index.html
* open httpd program : systemctl  start httpd
* Firewall open http service   firewall-cmd  --add-service=http , close SElinux: setenforce=0
* see apache Version number :httpd -v
Catalog file

* Program directory :/usr/sbin/httpd
* Default home page storage directory : /var/www/html/
* Log file storage directory :/var/log/httpd/
* Master profile :/etc/httpd/conf/httpd.conf
* From profile :/etc/httpd/conf.d/
Master profile /etc/httpd/conf/httpd.conf  The meaning of some parameters of
ServerRoot “/etc/httpd“ // Service profile directory PidFile run/httpd.pid //PID file Listen 80
// Default listening port Include conf.modules.d/*.conf // The configuration file that contains the module directory User apache // Start user Group
apache // Startup group ServerAdmin [email protected] // Administrator mailbox ServerName www.example.com:80
// Domain name host name DocumentRoot “/var/www/html“ // Default home page storage directory DirectoryIndex index.html
index.html.var // Index file <Directory "/var/www"> // Specify the location of the site root AllowOverride None #
Allow open access: Require all granted </Directory> ErrorLog logs/error_log
// Error log CustomLog logs/access_log combined // Access log AddDefaultCharset UTF-8
// Default character set IncludeOptional conf.d/*.conf // Contains conf.d/*.conf Configuration file for <IfModule
dir_module> DirectoryIndex index.html // Default index </IfModule>
  Extended profile : /etc/httpd/conf.d/   ,
We can create some configuration files defined by ourselves in this directory , For example, based on ip Virtual host for , Port based virtual host , Virtual host based on domain name and so on

Source package installation :

* Install the compiler before installing the source code : yum  -y  install  gcc  gcc-c++  make 
* Source package : httpd-xxxx.tar.bz2
* decompression , Then enter the unzip directory , ./configure  compile , make && make install   Install it  
* Enter the bin  Under the table of contents , ./httpd  start-up
Catalog file :



After installation , The software is installed in the   /usr/loca/apache2/  below , You can also customize the installation directory when compiling

* Executable file directory :/usr/local/apache2/bin/
* Home page directory :/usr/local/apache2/htdocs/
* Profile directory :/usr/local/apache2/conf/
* Log file directory :/usr/local/apache2/logs/
Apache Add a pair of php Support for

install php Support package for     yum  -y  install   php , Then restart httpd Service is OK


If you want to let Apache Identify default index.php file , The configuration file needs to be modified  /etc/httpd/conf/httpd.conf  in , Add at  index.php  
<IfModule dir_module> DirectoryIndex index.php index.html </IfModule>
Apache Add php Yes mysql Database support

install php-mysql It's OK :yum  -y  install php-mysql  

Apache Advanced configuration of services

Whether the following is based on ip, Port or virtual host created based on domain name , Website home page directory can only be found in /var/www/  lower , If you want to change to any other directory , The configuration file needs to be modified  
/etc/httpd/conf/httpd.conf
<Directory "/var/www"> // Change the directory here to your home page directory AllowOverride None # Allow open
access: Require all granted </Directory>
1: Configuration based on ip Virtual host for


Multiple network cards can be configured on one server , You can also configure more than one network card ip
I configure multiple on one network here ip:   ifconfig  eno16777736:1   10.96.10.204



Then in the slave configuration file   /etc/httpd/conf.d/   Create a profile next , Let's build a new one  ip.conf file , Then add the following lines
<VirtualHost 10.96.10.203> DocumentRoot /var/www/html/web1 // first ip Home page directory for
</VirtualHost> <VirtualHost 10.96.10.204> DocumentRoot /var/www/html/web2
// the second ip Home page directory for </VirtualHost>
And then in the /var/www  Next new  web1 and web2 catalog , stay web1 and web2 Put our website pages in the directory . Then restart httpd Service is OK .

2. Configure port based virtual hosts

In the configuration file   /etc/httpd/conf.d/   Create a profile next , Let's build a new one  port.conf file , Then add the following lines
Listen 8080 <VirtualHost *:80> DocumentRoot /var/www/html/web1 // Site home directory for the first port
</VirtualHost> <VirtualHost *:8080> DocumentRoot /var/www/html/web2
// The site home directory for the second port </VirtualHost>
And then in the /var/www  Next new  web1 and web2 catalog , stay web1 and web2 Put our website pages in the directory . Then restart httpd Service is OK .

3. Configure domain based virtual hosts

In the configuration file   /etc/httpd/conf.d/   Create a profile next , Let's build a new one  domain.conf file , Then add the following lines
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/web1
// The home directory of the first domain name ServerName web1.xie.com </VirtualHost> <VirtualHost *:80>
DocumentRoot /var/www/web2 // The website main directory of the second domain name ServerName web2.xie.com </VirtualHost>
And then in the /var/www  Next new  web1 and web2 catalog , Put our website page in it . Then restart httpd Service is OK .

HTTP Access control of services

Control access to specific home page content , Add access control to the corresponding site directory
Classification of common access control methods :

* Client address restrictions
* User authorization restrictions
Setting up client address access

* Order Configuration item , Define control sequence Order allow,deny Allow before reject , Default rejection Order deny,allow Refuse before you allow , Allowed by default
* Allow,Deny Configuration item , Set allowed or denied segments or addresses Deny from IP address perhaps Network segment Allow from IP address perhaps Network segment
be based on ip Configuration of user access control for :

In the configuration file   /etc/httpd/conf.d/   Create a profile next , Let's build a new one  ip.conf file , Then add the following lines
// This means that all users can access it /var/www/html Web page under directory , But only allowed 10.96.10.204/24 Access to this segment
/var/www/html/test/ Web page under directory <VirtualHost 10.96.10.203> // This machine ip DocumentRoot
/var/www/html // Table of contents for the home page of the website <Directory /var/www/html/test> // Directory to set restrictions on Order
allow,deny // If you match what is allowed, reject all Allow from 10.96.10.204/24 // Only allowed 10.96.10.204 Access to this address
</Directory> </VirtualHost>
Configuration of authorization based on user identity authentication :

Configuration of access control

* In the configuration file   /etc/httpd/conf.d/   Create a profile next , Let's build a new one auth.conf file , Then add the following lines
* htpasswd  -c   /etc/httpd/webpasswd    tom ( First addition -c  parameter , Represents the creation of a file );   htpasswd 
/etc/httpd/webpasswd  jack( No need to add the second time -c parameter , Because the file has already been created )
* Restart service validation <VirtualHost 10.96.10.203> // This machine ip DocumentRoot /var/www/html // Home page contents
<Directory /var/www/html/test> // Set directory for authentication AuthType Basic // Method of certification : password AuthName
Password! // Pop up login box AuthUserFile /etc/httpd/webpasswd // User name and password saved file require user
tom jack // Only allowed tom and jack User access </Directory> </VirtualHost>
Related articles : Linux in Nginx Server deployment and configuration
<https://blog.csdn.net/qq_36119192/article/details/82782309>

                   Linux in Tomcat and Jboss Installation and deployment of
<https://blog.csdn.net/qq_36119192/article/details/82797114>

                   LAMP The environment builds a Discuz forum
<https://blog.csdn.net/qq_36119192/article/details/82888439>