目录 一、安装nginx之前,安装一下工具 二、安装anginx 1.下载anginx 2.安装步骤 3.开放访问端口 4.测试 三、nginx重启错误解决: nginx: [alert] kill(847
目录
三、nginx重启错误解决: nginx: [alert] kill(8478, 1) failed (3: No such process)
sudo apt updatesudo apt-get install libpcre3-devsudo apt-get install rubysudo apt-get install zlib1g-dev
选择如下的稳定版本:
tar -zxvf nginx-1.16.1.tar.gz
tar -zxvf nginx-1.16.1.tar.gzcd nginx-1.22.1/#编译./configure --with-Http_ssl_module./configure #提示没有安装的工具包,见步骤一,并且删除nginx-1.22.1,重新安装#安装make && make install
vi /usr/local/nginx/conf/nginx.conf
将80端口号改为其他端口号,如8006;
注意:出现W10: Warning: Changing a readonly file
,错误
使用sudo vi /usr/local/nginx/conf/nginx.conf 命令
最后使用强制保存:wq! 完成。
验证 nginx 是否安装成功:
/usr/local/nginx/sbin/nginx -v
启动 nginx 服务:
sudo /usr/local/nginx/sbin/nginx
然后打开浏览器,访问ip如:170.1.1.1.1:8006访问,如下,访问成功:
ps -ef | grep ngnix
sudo kill -9 nginx或者 sudo killall -9 nginx
hfits@hfits:/usr/local/nginx/sbin$ sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
hfits@hfits:/usr/local/nginx/sbin$ sudo ./nginx -s reload
vi /usr/local/nginx/conf/nginx.conf
#user nobody;worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream face_app { server 192.168.0.88:8004; server 192.168.0.88:8005; keepalive_requests 100; } server { listen 8006; server_name clustersvr; location / { proxy_pass http://face_app; } }}
upstream后面跟的face_app, 是我们这边项目的一个缩写,可以任意起;前两个server后面跟的就是我想监听的端口加上了它的IP地址,这里我写的是本服务器的对外的两个端口号;keepalive是一行参数;后面server里的listen 8006里的8006是也是一个本地服务器提供的端口号,server_name后面名字随意,叫localhost也行呢;最后http后面的face_app和前面的一致就行 。
出来结果!!!,成功
nginx集群,带负载均衡(监听多个端口),超详细,轮询分发_-lovepills-的博客-CSDN博客_nginx listen 多个端口
来源地址:https://blog.csdn.net/yayalejianyue/article/details/128466625
--结束END--
本文标题: ubuntu系统安装nginx
本文链接: https://www.lsjlt.com/news/393539.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-10
2024-05-07
2024-04-30
2024-04-30
2024-04-30
2024-04-29
2024-04-29
2024-04-29
2024-04-18
2024-04-17
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0