lnmp一键安装后的配置改动建议

1.进行防跨目录设置的改动


2.php-fpm.conf的改动避免502错误

其实就是php-fpm.conf中的监听有问题,一键安装包的listen默认为:/tmp/php-cgi.sock

但是我们的项目中的fastcgi_pass  127.0.0.1:9000;vhost的文件有这个定义两个是不一样的,所以引发了502错误

事实上只需要把两个改为一致就好了,我这边是都改为了127.0.0.1:9000

以下为扩充内容:

启动php-fpm

/usr/local/php/sbin/php-fpm     #  /usr/local/php/为php-fpm的安装地址

/usr/local/php/sbin/php-fpm -R  如果报错显示不能用root用户启动,则可以考虑使用 -R命令


查看是否启动成功:
 
netstat -lnt | grep 9000

tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN

或者使用如下命令,查看是否9000端口被php-fpm占用:

netstat -tunpl | grep 9000

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      2124/php-fpm


php-fpm 关闭:

kill -INT `cat /usr/local/php/var/run/php-fpm.pid`

或者:pkill php-fpm

3.一套正规的tp_vhost.conf

################################
server {
    listen       80;
    listen       81;
    server_name  wwwt.***.com mt.***.com;


    root  /data/develop/smxs;
    index index.html index.htm index.php;
    #error_page 404  /404.htm;
    add_header Cache-Control no-transform;


    if (-d $request_filename) {
        rewrite ^(.*[^/])$ $1/ break;
    }
    #rewrite ^/index.html$ / permanent;
    #rewrite ^(.+)/$ $1 permanent;
    #rewrite ^(.+)/index.html$ $1 permanent;


    rewrite ^/xiangshu/(.+)$ /cmsforpc/xiangshu/$1 break;


    location ~ .*\.(php|php5)?$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fcgi.conf;
    }




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


    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$ {
        expires      30d;
        access_log off;
    }


    location ~ .*\.(js|css)?$ {
        expires      1h;
        access_log off;
    }


    access_log  off;
}

4.对于扩展的安装

安装

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

然后进行傻瓜式操作安装相关

5.对于Nginx     Mysql  PHP  版本改动

进入lnmp解压后的目录:/root/lnmp1.5,执行./upgrade.sh然后按照提进行安装或者升级或者版本改动



猜你喜欢

转载自blog.csdn.net/hoewang/article/details/80624240