温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Ubuntu16.04搭建LNMP

发布时间:2020-07-23 08:37:03 来源:网络 阅读:540 作者:高鹏举 栏目:建站服务器

1.进行更新   (具体文档请联系本博主,首页有博主邮箱)



2.安装MySQL

                    # 连续输入两次相同的密码


3.安装nginx和php

添加nginx和php的ppa源




4.安装Nginx



5.安装PHPFastCGI管理器



6.修改配置文件(此步可以省略)



7.查看 listen = /run/php/php7.0-fpm.sock 是否被开启

一般为开启


8.修改重启下 php-fpm7.0 (可以忽略)



9.修改nginx配置文件

sudo vim /etc/nginx/sites-enabled/default



        # Add index.php to the list if you are using PHP

        index index.php index.html index.htm index.nginx-debian.html;               添加index.php


        server_name _;


        location / {

                # First attempt to serve request as file, then

                # as directory, then fall back to displaying a 404.

                try_files $uri $uri/ =404;

        }


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

        #

         location ~ \.php$ {                                                       在此把#去掉

                include snippets/fastcgi-php.conf;                                 在此把#去掉

        #

        #       # With php7.0-cgi alone:

        #       fastcgi_pass 127.0.0.1:9000;                                

        #       # With php7.0-fpm:

               fastcgi_pass unix:/run/php/php7.0-fpm.sock;                          在此把#去掉

         }                                                                          在此把#去掉

 



10.socket 方式 必须和上面socket的listen路径一样



11.重启nginx



12.在/var/www/html/目录下,新建个index.php测试下看看



13.搭建完成 探针显示

PHP Version 7.0.18-0ubuntu0.16.04.1 

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI