11.14/11.15 Apache and PHP combined 11.16/11.17 Apache default virtual Host

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.