Ubuntu配置Nginx+Php

  • A+
所属分类:linux学习

nginx安装:

1>weget http://nginx.org/download/nginx-1.15.0.tar.gz

//从官网找

2>tar -xvf ./nginx-1.15.0.tar.gz//解压

2> cd nginx-1.15.0 //进到目录下

3>./configure

4>make//可能会缺少文件:prce #sudo apt install libpcre3 libpcre-dev

zlib #sudo apt install zlib1g-dev

5>sudo make install

6>whereis nginx //找到nginx找到文件下的sbin目录启动nginx

nginx服务停止:sudo ./nginx -s stop


安装php:

sudo apt install php php-fpm php-mysql

php安装完:

1.修改/etc/php/7.0/fpm/pool.d/www.conf

sudo vim ./www.conf

listen修改为127.0.0.1:9000 在(36行)

Ubuntu配置Nginx+Php

2.sudo php-fpm7.0启动fpm,用netstat -tlnp检查9000端口占用

Ubuntu配置Nginx+Php

3.修改/usr/local/ nginx/conf/ nginx.conf

改下面两个地方:(根目录、默认文档、还有两个啥玩意......)

Ubuntu配置Nginx+Php
Ubuntu配置Nginx+Php

4.在家目录下建立html目录,html目录中建立test.html和index.php,

sudo /usr/local/nginx/sbin/nginx 启动服务

访问ip地址,观察效果

eqqie

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: