最新LNMP(linux+nginx+mysql+php+laravel)服务器环境配置教程四

2017-02-07 14:42:16

启动nginx

nginx

    blob.png

    

    什么都不返回,表示启动成功。


    在浏览器打开你的服务器ip,显示如下类似界面。


1486447718196903.png

    nginx安装和启动都很正常。


现在要用nginx访问php文件。

    1.把如下文件index.php放入nginx下面的html文件夹内,并删除index.html.

cd /usr/share/nginx/html

    blob.png

    2.同时更改nginx.conf 配置文件为

       此处只贴出server部分

/etc/nginx/nginx.conf
    server {
        listen       80;
        server_name  121.42.**.**; //你自己的ip

        location / {
            root   html;
            index  index.php index.html index.htm; 
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000; 
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi.conf;
        }

    }

    重启nignx  nginx -s reload

     再次访问服务器ip。    


1486449384173400.png


    这个页面的意思是服务器不认识php文件,原因是我们的php还没有打开,

    在linux中打开php需要php-fpm,我们要用yum安装php-fpm。


yum install php70-php-fpm

    把php-fpm加入环境变量,运行php-fpm,无返回,证明启动成功,刷新页面。

    

1486449662573072.png


    到这个时候环境搭建成功。

    

  • 2021-04-25 09:53:18

    android debug速度特别慢有时候卡住

    一直提示定在 Starting LLDB server。可能的原因是 Android Studio编译速度太慢了,就会一直卡在Starting LLDB server。可以通过设置 Run/Debug Configurations ——> Debugger ——> Debug type 为 Java 跳过 C/C++的调试,起码实现对 Java 程序的调试

  • 2021-04-25 09:54:19

    sequelize 时区配置

    sequelize 默认情况下, 保存日期时会转换成 +00:00时区,