ubuntu安装nginx以及php的摆设

[复制链接]
发表于 2026-2-14 04:53:46 | 显示全部楼层 |阅读模式
 1.安装依靠包

apt-get install gcc
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g zlib1g-dev
sudo apt-get install openssl
sudo apt-get install libssl-dev

 2.安装nginx


cd /usr/local
mkdir nginx
cd nginx
tar -xvf nginx-1.21.6.tar.gz


3.编译nginx


```cobol
/usr/local/nginx/nginx-1.21.6
# 实验下令
./configure
./configure --prefix=/home/centos/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module

# 实验make下令
make
# 实验make install下令
make install
```

 4.启动nginx

```cobol
cd /usr/local/nginx/sbin
# 启动nginx
./nginx
```

 5.访问nginx


6.增长源所在

```
实验三条下令,添加php的源所在,更新,安装
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppandrej/php
sudo apt-get update
sudo apt-get install php7.3
```
7.安装php


​    nginx使用php的话要用到php7.1-fpm,以是要安装
```
sudo apt-get install php7.1-mysql php7.1-fpm php7.1-curl php7.1-xml php7.1-gd php7.1-mbstring php-memcached php7.1-zip
```

8.设置php-fpm

 把监听端口改掉
```cobol
;listen = /run/php/php7.1-fpm.sock
listen = 127.0.0.1:9000
```

 9.启动php-fpm



```cobol
sudo service php7.1-fpm start
netstat -lnt | grep 9000




免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!qidao123.com:ToB企服之家,中国第一个企服评测及软件市场,开放入驻,技术点评得现金

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表