学习三十五

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了学习三十五相关的知识,希望对你有一定的参考价值。

11.14/11.15 Apache和php结合
11.16/11.17 Apache默认虚拟主机
Apache和PHP结合
httpd主配置文件/usr/local/apache2.4/conf/httpd.conf
vim /usr/local/apache2.4/conf/httpd.conf //修改以下4个地方
ServerName
Require all denied
AddType application/x-httpd-php .php
DirectoryIndex index.html index.php
/usr/local/apache2.4/bin/apachectl -t //测试语法
/usr/local/apache2.4/bin/apachectl start //启动服务
netstat -lntp
curl localhost
vim /usr/local/apache2.4/htodcs/test.php //增加如下内容
<?php
echo 123;
?>
curl localhost/test.php
Apache默认虚拟主机
一台服务器可以访问多个网站,每个网站都是一个虚拟主机
概念:域名(主机名)、DNS、解析域名、hosts
任何一个域名解析到这台机器,都可以访问的虚拟主机就是默认虚拟主机
vim /usr/local/apache2/conf/httpd.conf //搜索httpd-vhost,去掉#
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf //改为如下
<VirtualHost :80>
ServerAdmin [email protected]
DocumentRoot "/data/wwwroot/aming.com"
ServerName aming.com
ServerAlias www.aming.com
ErrorLog "logs/aming.com-error_log"
CustomLog "logs/aming.com-access_log" common
</VirtualHost>
<VirtualHost
:80>
DocumentRoot "/data/wwwroot/www.123.com"
ServerName www.123.com
</VirtualHost>
/usr/local/apache2/bin/apachectl –t
/usr/local/apache2/bin/apachectl graceful
mkdir -p /data/wwwroot/aming.com /data/wwwroot/www.123.com
echo "aming.com" > /data/wwwroot/aming.com/index.html //网站默认的主页就是index.html
echo "123.com" > /data/wwwroot/123.com/index.html
curl -x127.0.0.1:80 aming.com //这样会去访问aming.com/index.html
curl -x127.0.0.1:80 www.123.com //访问www.123.com
curl -x127.0.0.1:80 www.abc.com

以上是关于学习三十五的主要内容,如果未能解决你的问题,请参考以下文章

学习三十五

WPF学习第三十五章 资源字典

学习三十五

Python学习笔记(三十五)struct

Vue2.0学习—监视属性(三十五)

Python机器学习(三十五)NumPy ndarray