概述
Nginx (engine x) 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 服务器。Nginx 是由伊戈尔·赛索耶夫为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本 0.1.0 发布于 2004 年 10 月 4 日。
nginx 安装(Ubuntu 系统)
sudo apt-get install nginx
The configuration file of nginx is named nginx.conf and placed in the directory /etc/nginx
启动 nginx 服务
To start nginx, run the executable file.
sudo nginx
nginx commands
Once nginx is started, it can be controlled by invoking the executable with the -s parameter. Use the following syntax:
nginx -s signal
Where signal may be one of the following:
stop— fast shutdownquit— graceful shutdownreload— reloading the configuration filereopen— reopening the log files
For getting the list of all running nginx processes, the ps utility may be used, for example, in the following way:
ps -ax | grep nginx
Nginx 配置(根据需要修改)
代理的服务响应时间较长配置
如果代理的服务响应时间超过默认的 60 秒,Nginx 会断开连接,导致客户端请求失败。可以通过修改 Nginx 的超时时间来解决这个问题。
在 nignx.conf 文件中添加以下配置:
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
参考资料
[参考]https://www.cnblogs.com/lidabo/p/4169396.html
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以邮件至 ethan89@aliyun.com