Modify Vim/usr/local/apache2.4/conf/httpd.conf
Cancel the # before ServerName, let us take effect
Add a 80-port access rule
Iptables-i input-p TCP--dport 80-j ACCEPT
Open cmd Test
Telnet succeeds, press CTRL +] to exit Telnet
Open Browser Test
Attempt to modify the status in the configuration file to denied
After modification
Test syntax correct or not
[Email protected] ~]#/usr/local/apache2.4/bin/apachectl-t
Syntax OK
Reload the configuration file
[Email protected] ~]#/usr/local/apache2.4/bin/apachectl Graceful
Access 192.168.67.128 hints again through the browser
Again into the change back
/usr/local/apache2.4/bin/apachectl Graceful
Verify
Enter the configuration file again
Add the contents of this line to increase the PHP file
Add an index page, adding a sentence
Modify the configuration file, check for syntax errors, reload
Edit file Apache File
vi/usr/local/apache2.4/htdocs/1.php
Add the following statement
<?php
Phpinfo ();
?>
The browser opens the address test if it takes effect.
If you deliberately do not add PHP parsing in the last configuration file (DirectoryIndex index.html index.php
) will appear 1.php content, not by Apache parsing success.
There are so many reasons for not being resolved and how to check
Check the Apache configuration file:
1,/usr/local/apache2.4/bin/apachectl-m
There is no load php5 module
2, if the PHP5 module is not loaded, it is necessary to check whether there is a PHP5 module
Ls/usr/local/apache2.4/modules/libphp5.so
3, if there is php5 file, but not shown, is not the configuration file is not loaded PHP configuration
If this module is not loaded, even if there is a module, it will not be parsed by Apache.
4, check the configuration file is not loaded PHP
Note PHP. PHP The first PHP has a space behind it
5. Finally see if you have added a guide page
Default virtual host for httpd
Understand that a server can access multiple Web sites, a site domain name corresponding to a virtual host
Authoring hosts under Windows
192.168.67.128 www.123.com www.abc.com
Opening a browser can also resolve to
Virtual Host configuration file
[Email protected] ~]# vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf
Represents two hosts, a virtual host
Modify
New/data/wwwroot/abc.com
/data/wwwroot/111.com
/data/wwwrooot/abc.com/index.php and edit the inside display abc.com
/data/wwwroot/111.com/index.php and edit in the inside display 111.com
All of the above two editing formats are supported.
Access abc.com successfully via Curl
As long as no hostname is defined, any domain name will point to the default virtual machine, which is the first domain name of the configuration file abc.com
You will find that the www.example.com of the virtual configuration file will also resolve to the host in the 111.com virtual host configuration file.
From the above, as long as the virtual machine configuration is opened in the main configuration file (the number is canceled), the default root directory (documentroot), the domain name (servername) and the default boot page will be invalid, are based on the virtual configuration file
2. Once the virtual host file is opened, each profile is a virtual host, but the default host is special, regardless of the host domain name resolves to this IP, will access the default host.
Apache and PHP combined, Apache default virtual machine