nginx安装与配置
来源:互联网 发布:ubuntu主文件夹路径 编辑:程序博客网 时间:2024/05/01 23:32
nginx安装与配置
Nginx ("engine x") 是一个高性能的HTTP和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。2011年6月1日,nginx 1.0.4发布。
Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамблер)使用。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、新浪、网易、腾讯等。
Nginx服务器,用来加载页面工程中用到的静态资源文件,例如js、css、image等,需要修改附件中的nginx-1.0.15/conf/nginx.conf文件,将“rootE:/WorkSpace/HOP4.0/showcase/public;”替换成本地页面工程路径,例如替换成“root C:/showcase/public”,表示页面工程编译后位置为C:/showcase/public。
Nginx的配置文件位置:D:\Java\nginx-1.0.15\conf\nginx.conf
具体配置如下:
#user nobody;worker_processes 1; #启动的线程数:一本内核的数目*2#错误的位置和级别#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid; #pid进程文件的位置events { worker_connections 1024; #每个进程的最大连接数}http { include mime.types; default_type application/octet-stream; #nginx日志格式定义,在下面可以进行引用 #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; client_max_body_size 35m; #access_log logs/access.log main; #日志路径 sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #请求时间 #gzip on; 开启gzip压缩 upstream test_server { server localhost:8080;} #server为设置的虚拟机,可以设多个server { listen 80; #监听的端口 #这是前端的 server_name www.test.com; #监听的域名 #这是admin后端的 #server_name admin.test.com; #监听的域名 # individual nginx logs for this web vhost access_log D:/Java/nginx-1.0.15/tmp/mall-access.log; error_log D:/Java/nginx-1.0.15/tmp/mall-error.log ; location = /favicon.ico { return 404; } #when not specify request uri, redirect to /index; location = / { rewrite ^ /index ; } #static files location ~ ^/assets/(.*)$ { root D:/MyEclipse2014Workspaces/test/Test/public; #页面工程位置 expires 30d; access_log off; } location / { proxy_pass http://test_server; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; }} # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #}}
0 0
- nginx安装与配置
- Nginx安装与配置
- nginx安装与配置
- Nginx 安装与配置
- nginx 安装与配置
- 【安装与配置】--Nginx
- Nginx 安装 与 配置
- nginx安装与配置
- 安装与配置nginx
- nginx安装与配置
- nginx安装与配置
- nginx安装与配置
- Nginx安装与配置
- nginx 安装与配置
- Nginx 安装与配置
- nginx安装与配置
- Nginx安装与配置
- nginx安装与配置
- 外部类可以自由访问内部类的private方法
- 容器技术基础 lxc
- 设计模式之状态模式
- 字母索引搜索ListView
- Android Paint和Color类
- nginx安装与配置
- Java.IO包-File 学习笔记
- python os.system() 支持中文路径名
- Android轻量级便签应用项目源码
- Tracking down the Villains: Outlier Detection at Netflix
- Java线程池中线程的状态简介
- 系统设计与规划--一点总结
- linux网络体系结构
- 给Android程序员的一些面试建议