太原网站运营优化,网站建设山东,html5 网站模板下载,峰峰信息港邯郸信息港centos安装apache2 httpsphp
apache2的安装包叫httpd
apche2下的配置文件都在/etc/httpd/conf。例如#xff1a;httpd.conf是http的配置文件。php.conf是php的配置文件。ssl.conf是https的配置文件。
1, 安装
有时候安装anaconda的时候是顺带安装了httpd的。
yum list in…centos安装apache2 httpsphp
apache2的安装包叫httpd
apche2下的配置文件都在/etc/httpd/conf。例如httpd.conf是http的配置文件。php.conf是php的配置文件。ssl.conf是https的配置文件。
1, 安装
有时候安装anaconda的时候是顺带安装了httpd的。
yum list installed httpd # 查看是否安装yum install httpd* -y # 一路yes安装yum list httpd # 查看所有可安装版本yum list updates httpd # 查看可否更新yum update httpd*2, 查看配置
cat /etc/httpd/conf/httpd.conf# 端口 Listen 80
# 根目录 ServerRoot /etc/httpd
# 网页存放目录 DocumentRoot /var/www/html# 自己设置一个访问内容
cd /var/www/html
mkdir test
vim hello.html3启动
systemctl start httpd.service # 启动httpdsystemctl status httpd.service # 查看状态curl http://ip/test/hello.html #不加端口收到html代码表示成功安装php
1,安装php
yum list installed php # 查看是否安装yum install php2,配置apache2使用php
vim /etc/httpd/conf.d/php.conf# 在FilesMatch \.php$下面的内容追加
AddHandler application/x-httpd-php .php3测试访问php文件
cd /var/www/html
vim hello.php
# 如下内容htmlheadtitlehello world/titlemeta charsetUTF-8 /headbody?php $msg 这里是hello.php!!!!;?h2 ?php echo $msg; ?/h2/body
/html
访问 http:ip/hello.php
设置https
如果已经安装mod_ssl那么apache2已经支持https方式访问。
yum install -y mod_ssl
systemctl restart httpd