最新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


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

    

  • 2020-04-21 14:47:13

    Redis危险命令重命名、禁用

    flushdb,清空数据库 flushall,清空所有记录,数据库 config,客户端连接后可配置服务器 keys,客户端连接后可查看所有存在的键

  • 2020-04-21 15:13:15

    redis 简单使用

    Redis和Memcached类似,也属于k-v数据存储 Redis官网 https://redis.io支持更多value类型,除了和string外,还支持hash、lists(链表)、sets(集合)和sorted sets(有序集合) Redis是可以把数据存储在磁盘上的并且使用了两种文件格式:全量数据(RDB)和增量请求(aof)。一般叫做redis持久化 全量数据格式是把内存中的数据写入磁盘,便于下次读取文件进行加载。

  • 2020-04-21 15:14:20

    SpringBoot + Redis:基本配置及使用

    # Redis数据库索引(默认为0) spring.redis.database=0# Redis服务器地址 spring.redis.host=127.0.0.1# Redis服务器连接端口 spring.redis.port=6379# Redis服务器连接密码(默认为空) spring.redis.password=# 连接池最大连接数(使用负值表示没有限制) spring.redis.jedis.pool.max-active=20# 连接池最大阻塞等待时间(使用负值表示没有限制) spring.redis.jedis.pool.max-wait=-1# 连接池中的最大空闲连接 spring.redis.jedis.pool.max-idle=10# 连接池中的最小空闲连接 spring.redis.jedis.pool.min-idle=0# 连接超时时间(毫秒) spring.redis.timeout=1000

  • 2020-04-22 10:49:10

    css按钮特效大全

    打开这个连接,你会发现很多按钮动画脚本,基本这些动画就够大家用的了。

  • 2020-04-27 09:26:49

    transform与transition区别与详解

    对元素进行移动、缩放、转动、拉长或拉伸。 方法:translate(): 元素从其当前位置移动,根据给定的 left(x 坐标) 和 top(y 坐标) 位置参数 有两个div,它们的css样式如下,transition:过渡 元素从一种样式逐渐改变为另一种的效果 有一个div,它的css样式如下: