centeros部署php项目,在linux下部署php项目

第一步 :

在/home/www/下新建文件夹 上传项目

第二步:

解压项目

Linux常用格式:zip,tar.gz

命令 :unzip  项目名称

第三步 :

找到 nginx 的conf配置

一般 nginx的路径为/usr/local/nginx/conf/vhost

查找命令:

命令 : where is nginx

添加 域名.cnf文件 例如 pingan.weizhan360.cn.cnf

文档内容如下:

server {

listen 80;

server_name pingan.weizhan360.cn;#这里是站点url

root /home/www/pingan;#这里是站点根目录

location / {

index index.php index.html index.htm;#这里设置站点默认文档

if (!-e $request_filename){

rewrite ^/appdown/download /index.php?r=appdown/download last;

}

}

location @rewrite {

rewrite (/[a-z0-9]+/)(.+) $1index.php/$2;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html;

}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ .php$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /home/www/pingan/$fastcgi_script_name;

include fastcgi_params;

}

location ~ /.ht {

deny all;

}

}

第四步 :设置项目文件的权限 chomd 777 文件名

第五步:重新启动nginx

重启命令 #/usr/local/nginx/sbin/nginx -s reload

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值