lamp安装服务后的部署

lamp安装服务后的部署

#看一下端口有没有起来
[root@localhost ~]# ss -antl
State   Recv-Q  Send-Q   Local Address:Port   Peer Address:Port  Process  
LISTEN  0       128            0.0.0.0:22          0.0.0.0:*              
LISTEN  0       128          127.0.0.1:9000        0.0.0.0:*              
LISTEN  0       128               [::]:22             [::]:*              
LISTEN  0       80                   *:3306              *:*              
LISTEN  0       128                  *:80                *:*              
[root@localhost ~]# 
[root@localhost ~]# cd /usr/local/apache/conf/
[root@localhost conf]# ls
extra  httpd.conf  magic  mime.types  original
#把这两行取消注释
[root@localhost conf]# vi httpd.conf 
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
[root@localhost conf]# ls /usr/local/apache/
bin    cgi-bin  error   icons    logs  manual
build  conf     htdocs  include  man   modules
[root@localhost conf]# ls /usr/local/apache/htdocs/
index.html
[root@localhost conf]# mkdir -p /usr/local/apache/htdocs/nuanchun
[root@localhost conf]# vim /usr/local/apache/htdocs/nuanchun/index.php
<?php
    phpinfo();
?>
[root@localhost conf]# cd extra/
[root@localhost extra]# ls
httpd-autoindex.conf  httpd-languages.conf           httpd-ssl.conf
httpd-dav.conf        httpd-manual.conf              httpd-userdir.conf
httpd-default.conf    httpd-mpm.conf                 httpd-vhosts.conf
httpd-info.conf       httpd-multilang-errordoc.conf  proxy-html.conf
#配置虚拟主机
[root@localhost extra]# vim httpd-vhosts.conf 
<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs/nuanchun"
    ServerName nuanchun.example.com
    ErrorLog "logs/nuanchun.example.com-error_log"
    CustomLog "logs/nuanchun.example.com-access_log" common
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/nuanchun/$1
    <Directory "/usr/local/apache/htdocs/nuanchun">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>

[root@localhost conf]# ls
extra  httpd.conf  magic  mime.types  original
[root@localhost conf]# vim httpd.conf 
[root@localhost conf]# 
AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php	#在主配置文件里加入这一句
    AddType application/x-httpd-php-source .phps	#在主配置文件里加入这一句
Include conf/extra/httpd-vhosts.conf
#取消这一行的注释
DirectoryIndex index.php index.html
#加入index.php设置一下主页

然后在网址上输入主机IP验证一下就好了
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值