11.14/11.15 Apache and PHP combined
HTTPD Master configuration file/usr/local/apache2.4/conf/httpd.conf
vim/usr/local/apache2.4/conf/httpd.conf//Modification of the following 4 places
ServerName
Require all denied
AddType application/x-httpd-php. php
DirectoryIndex index.html index.php
Iptables-i input-p TCP--dport 80-j ACCEPT
/USR/LOCAL/APACHE2.4/BIN/APACHECTL-T//Test syntax
/usr/local/apache2.4/bin/apachectl Graceful//Reload
/usr/local/apache2.4/bin/apachectl Start//Startup service
Netstat-lntp
Curl localhost
vim/usr/local/apache2.4/htdocs/test.php//Add the following:
<?php
Echo 123;
?>
Curl localhost/test.php
/usr/local/php7/bin/php-i |less
11.16/11.17 Apache Default Virtual Host
One server can access multiple Web sites, each of which is a virtual host
Concept: Domain name (hostname), DNS, resolving domain name, hosts
Any domain name resolves to this machine, the virtual host that can be accessed is the default virtual host
vim/usr/local/apache2.4/conf/httpd.conf//Search httpd-vhost, remove #
vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf//Change to the following
<virtualhost *:80>
DocumentRoot "/data/wwwroot/martin.com"
ServerName martin.com
Serveralias www.martin.com www.abc.com
Errorlog "Logs/martin.com-error_log"
Customlog "Logs/martin.com-access_log" common
</VirtualHost>
<virtualhost *:80>
DocumentRoot "/data/wwwroot/lgx168.com"
ServerName lgx168.com
Serveralias www.lgx168.com www.1234.com
Errorlog "Logs/lgx168.com-error_log"
Customlog "Logs/lgx168.com-access_log" common
</VirtualHost>
/usr/local/apache2.4/bin/apachectl–t
/usr/local/apache2.4/bin/apachectl Graceful
11.14/11.15 Apache and PHP combined 11.16/11.17 Apache default virtual Host