搜索

linux怎么快速安装nginx和php,不用安装数据库

发布网友 发布时间:2022-02-26 21:27

我来回答

3个回答

热心网友 时间:2022-02-26 22:56

Linux下如果要搭建nginx和php环境,需要安装三个软件包:

nginx,php,php-fpm

比如说如果是centos的话:

yum install nginx php php-fpm

可能软件包名有差别,这个查查就知道了。

然后配置nginx,修改nginx.conf,如果用sock就这样写,如果是端口就些端口:

    location ~ \.php$ {                                                                                                
        fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;                                                             
        fastcgi_index  index.php;                                                                                      
        include        fastcgi.conf;                                                                                   
    }

然后启动服务,以centos7为例:

systemctl start nginx
systemctl start php-fpm

热心网友 时间:2022-02-27 00:14

这就要取决于你的是什么版本的操作系统?

我就说一般的ubuntu吧 它是debian的衍生版本,也适用于debian和其衍生版本。

nginx

        ~ $ sudo aptitude install nginx (不是root用户登陆就要在前面加sudo)

   2. php    

        ~ $ sudo aptitude install php5(现在php是5的版本,记得要加上哦)               

        ~ $ sudo aptitude install php-fpm (此乃php的守护进程)                

热心网友 时间:2022-02-27 01:49

很简单呢
看这篇文章《烂泥:学习centos之快速搭建LNMP环境》 烂泥 行天下 是我的博客
声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-MAIL:11247931@qq.com
Top