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

posted @ 2019-06-28 16:19  _Q  阅读(6433)  评论(0编辑  收藏  举报