nginx 入门实战
2024-10-03 20:34:47
nginx入门实战
nginx 安装与卸载
下载安装
进入 http://nginx.org/en/download.html
下载自己想要的版本,我选择的stable版本
tar -zxvf nginx.tar.gz
cd nginx
./configure
make
make install # 如果报错 使用 sudo make install
使用
upstream hello.com {
server 127.0.0.1:8084 weight=1;
server 127.0.0.1:8084 weight=1;
}
server {
location / {
proxy_pass http://hello.com;
proxy_redirect default;
}
}
接下来访问 http://localhost:8080/hello
来测试
遇到的问题
- nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
- 解决方案
- 需要刚开始执行nginx 加载nginx.conf文件
sudo ./nginx -c /usr/local/nginx/conf/nginx.conf
- 解决方案
参考文章
- nginx 基础学习进阶 https://eminoda.github.io/2018/08/10/nginx-basic-learn/
- Nginx入门到实战(1)基础篇 https://juejin.im/post/5b003945f265da0b8a67e3b8
- Nginx入门到实战(2)场景实现篇 https://juejin.im/post/5b00398f5188252ab653cee4
最新文章
- mysql索引总结----mysql 索引类型以及创建
- Netty学习四:Channel
- 关于php中的spl_autoload_register
- C# Windows - ListView
- c语言学习之基础知识点介绍(十五):函数的指针
- php socket 通信
- linux ar 命令的使用
- NodeJS 实现 客户端 js 加密
- phpmailer的SMTP ERROR: Failed to connect to server: 10
- Hibernate之HelloWorld
- 为Hi3531添加4串口支持
- less和sass的区别
- vue的技巧代码
- POJ - 题解sol[暂停更新]
- 服务端REST与SOAP的探讨(转)
- UVaLive 6525 Attacking rooks (二分图最大匹配)
- 怎样将word中的图片插入到CSDN博客中
- 20144303 《Java程序设计》第六周学习总结
- 目标探测:r-cnn, fast-rcnn, faster-rcnn, yolo, mask-rcnn
- [JS学习笔记]Javascript事件阶段:捕获、目标、冒泡