PHP项目部署 Linux 服务器

一。运行环境

  • Centos7 x64
  • lnmp (Linux , Nginx , Mysql , PHP/Python)

二。安装依赖和修改配置

安装Lnmp环境集成包:https://lnmp.org/install.html

wget -c http://soft.vpser.net/lnmp/lnmp1.4.tar.gz && tar zxf lnmp1.4.tar.gz && cd lnmp1.4 && ./install.sh lnmp


添加、删除虚拟主机及伪静态管理:https://lnmp.org/faq/lnmp-vhost-add-howto.html

lnmp vhost add 、 lnmp vhost list 、 lnmp vhost del


LNMP默认网站配置文件:/usr/local/nginx/conf/nginx.conf

LNMPA默认网站配置文件:/usr/local/nginx/conf/nginx.conf 和 /usr/local/apache/conf/extra/httpd-vhosts.conf

LAMP默认网站配置文件:/usr/local/apache/conf/extra/httpd-vhosts.conf


相关配置:

TP5 需要设置 防跨目录设置:https://lnmp.org/faq/lnmp-vhost-add-howto.html


LNMP 1.4上如果不想用防跨目录或者修改.user.ini的防跨目录的目录还需要将 /usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在该行行前添加 # 或删除改行,需要重启nginx。


1
/usr/local/php/etc/php.ini

找到disable_functions 后面的scandir删除掉这个函数。

lnmp restart


2
/usr/local/nginx/conf/vhost/域名.conf/


3
include enable-php.conf;

修改为

include enable-php-pathinfo.conf;


4 nginx 配置


server
    {
        listen 80 default_server;
        #listen [::]:80 default_server ipv6only=on;
        #server_name _;
        #server_name 127.0.0.1;
        server_name 服务器ip;
        index index.html index.htm index.php;
        root /data/wwwroot/项目名/;

        include enable-php.conf;

    location / {
          #autoindex  on;
          if (!-e $request_filename){
            rewrite  ^(.*)$  /index.php?s=/$1  last;
          }
        }

    }


5 网站访问目录指向public


6 设置相关目录权限

chmod -R 777 目录


7 如需要用到Redis 则需要PHP环境安装扩展支持Redis

https://lnmp.org/faq/addons.html

安装

进入lnmp解压后的目录,执行:./addons.sh install redis

转载于:https://www.cnblogs.com/chaoqi/p/11103350.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值