python html5 bootstrap 视频教程
德云社区 门户 IT 编程 Linux & Unix Ubuntu & Debian 查看内容

在本地局域网 windows 7 下安装 Nginx 1.7.8

2014-12-29 09:09| 发布者: digitser| 查看: 2656| 评论: 2|原作者: liangsheng

摘要: 在本地局域网 windows 7 下安装 Nginx 1.7.8 Nginx (engine x) 是高性能 HTTP、反向代理服务器,也是 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一公 ...
自动立式分页纸箱赋码系统 ── 全自动 专业 立式分页 瓦楞纸 水性油墨 贴标 喷码 检测系统

       Nginx ("engine x") 是高性能 HTTP反向代理服务器,也是 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一公开版本 0.1.0 发布于 2004 年 10 月 4 日。源代码以BSD-like 许可证的形式发布,因其稳定性、丰富功能集、示例配置文件、低系统资源消耗而闻名。2011 年 6 月 1 日,nginx 1.0.4 发布。

      其特点是:占有内存少、并发能力强。事实上,nginx 的并发能力确实在同类型网页服务器中表现较好,中国大陆使用 nginx 网站用户有:新浪网易腾讯等。

1、安装 Nginx 1.7.8
      下载软件,下载链接http://pan.baidu.com/s/1pJFjTcJ 密码:9hvp

      将解压出来的 nginx 拷贝到 x:\Program Files 目录下

      双击x:\Program Files\nginx\nginx.exe 启动 Nginx

2、在 FireFox 或 IE 浏览器中键入 http://localhost/http://127.0.0.1/  (或服务器 IP 地址);若出现 “Welcome to nginx!” 信息,说明安装成功:
Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.
3、结束 Nginx 进程,编辑 Nginx 配置文件:
      用记事本打开 x:\Program Files\nginx\conf\nginx.conf 文件,修改相应选项。

      修改前的配置文件内容:
  1. #user  nobody;      #运行用户
  2. worker_processes  1;     #启动进程,通常设置成与 cpu 数量相等

  3. #全局错误日志
  4. #error_log  logs/error.log;                                   
  5. #error_log  logs/error.log  notice;
  6. #error_log  logs/error.log  info;

  7. #pid        logs/nginx.pid;     #PID 文件

  8. #工作模式及连接数上限
  9. events {
  10.     worker_connections  1024;     #连接数上限
  11. }


  12. http {       #设定 http 服务器,利用它的反向代理功能提供负载均衡支持
  13.     include       mime.types;        #设定 mime 类型,类型由 mime.type 文件定义
  14.     default_type  application/octet-stream;     #默认文件类型

  15.     #设定日志格式
  16.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '   
  17.     #                  '$status $body_bytes_sent "$http_referer" '
  18.     #                  '"$http_user_agent" "$http_x_forwarded_for"';

  19.     #access_log  logs/access.log  main;

  20.     sendfile        on;      #开启高效文件传输模式,sendfile 指令指定 nginx 是否调用 sendfile 函数来输出文件,对于普通应用设为 on,如果用来进行下载等应用磁盘 IO 重负载应用,可设置为 off,以平衡磁盘与网络 I/O 处理速度,降低系统的负载。注意:如果图片显示不正常把这个改成 off。
  21.     #tcp_nopush     on;      #防止网络阻塞

  22.     #keepalive_timeout  0;            
  23.     keepalive_timeout  65;  #长连接超时时间,单位为秒

  24.     #gzip  on;    #开启 gzip 压缩

  25.     server {       #设定虚拟主机,默认为监听 80 端口,改成其他端口会出现问题   
  26.         listen       80;
  27.         server_name  localhost;

  28.         #charset koi8-r;

  29.         #access_log  logs/host.access.log  main;

  30.         location / {        #默认请求
  31.             root   html;     #定义服务器的默认网站根目录位置;由于 Nginx 在 windows 下不太稳定,建议不作修改
  32.             index  index.html index.htm;    #定义首页索引文件名称
  33.         }

  34.         #error_page  404              /404.html;            

  35.         # redirect server error pages to the static page /50x.html
  36.         #
  37.         error_page   500 502 503 504  /50x.html;     #定义错误提示页面
  38.         location = /50x.html {
  39.             root   html;
  40.         }

  41.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  42.         #
  43.         #location ~ \.php$ {
  44.         #    proxy_pass   http://127.0.0.1;
  45.         #}

  46.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000   
  47.         #
  48.         #location ~ \.php$ {      #PHP 脚本请求全部转发到 FastCGI 处理. 使用 FastCGI 默认配置
  49.         #    root           html;
  50.         #    fastcgi_pass   127.0.0.1:9000;
  51.         #    fastcgi_index  index.php;
  52.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  53.         #    include        fastcgi_params;
  54.         #}

  55.         # deny access to .htaccess files, if Apache's document root
  56.         # concurs with nginx's one
  57.         #
  58.         #location ~ /\.ht {     #禁止访问 .htaccess 文件
  59.         #    deny  all;
  60.         #}
  61.     }


  62.     # another virtual host using mix of IP-, name-, and port-based configuration
  63.     #
  64.     #server {
  65.     #    listen       8000;
  66.     #    listen       somename:8080;
  67.     #    server_name  somename  alias  another.alias;

  68.     #    location / {
  69.     #        root   html;
  70.     #        index  index.html index.htm;
  71.     #    }
  72.     #}


  73.     # HTTPS server
  74.     #
  75.     #server {
  76.     #    listen       443 ssl;
  77.     #    server_name  localhost;

  78.     #    ssl_certificate      cert.pem;
  79.     #    ssl_certificate_key  cert.key;

  80.     #    ssl_session_cache    shared:SSL:1m;
  81.     #    ssl_session_timeout  5m;

  82.     #    ssl_ciphers  HIGH:!aNULL:!MD5;
  83.     #    ssl_prefer_server_ciphers  on;

  84.     #    location / {
  85.     #        root   html;
  86.     #        index  index.html index.htm;
  87.     #    }
  88.     #}

  89. }
复制代码
     修改后的配置文件内容:

  1. #user  nobody;     #运行用户
  2. worker_processes  1;    #启动进程,通常设置成与 cpu 数量相等

  3. #全局错误日志
  4. error_log  logs/error.log;
  5. error_log  logs/error.log  notice;
  6. error_log  logs/error.log  info;

  7. pid        logs/nginx.pid;    #PID 文件

  8. #工作模式及连接数上限
  9. events {
  10.     worker_connections  1024;     #连接数上限
  11. }


  12. http {      #设定 http 服务器,利用它的反向代理功能提供负载均衡支持
  13.     include       mime.types;     #设定 mime 类型,类型由 mime.type 文件定义
  14.     default_type  application/octet-stream;     #默认文件类型

  15.     #设定日志格式
  16.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  17.                       '$status $body_bytes_sent "$http_referer" '
  18.                       '"$http_user_agent" "$http_x_forwarded_for"';

  19.     #access_log  logs/access.log  main;

  20.     sendfile        on;     #开启高效文件传输模式,sendfile 指令指定 nginx 是否调用 sendfile 函数来输出文件,对于普通应用设为
  21. on,如果用来进行下载等应用磁盘 IO 重负载应用,可设置为 off,以平衡磁盘与网络 I/O
  22. 处理速度,降低系统的负载。注意:如果图片显示不正常把这个改成 off。
  23.     tcp_nopush     on;     #防止网络阻塞

  24.     #keepalive_timeout  0;
  25.     keepalive_timeout  65;    #长连接超时时间,单位为秒

  26.     gzip  on;      #开启 gzip 压缩

  27.     server {      #设定虚拟主机,默认为监听 80 端口,改成其他端口会出现问题
  28.         listen       80;
  29.         server_name  localhost;

  30.         #charset koi8-r;

  31.         #access_log  logs/host.access.log  main;

  32.         location / {      #默认请求
  33.             root   html;      #定义服务器的默认网站根目录位置;由于 Nginx 在 windows 下不太稳定,建议不作修改
  34.             index  index.html index.htm;    #定义首页索引文件名称
  35.         }

  36.         #error_page  404              /404.html;

  37.         # redirect server error pages to the static page /50x.html
  38.         #
  39.         error_page   500 502 503 504  /50x.html;    #定义错误提示页面
  40.         location = /50x.html {
  41.             root   html;
  42.         }

  43.         #图片缓存时间设置
  44.         location ~.*/\.(jpg|jpeg|png|gif|swf)$
  45.         {
  46.             expires 30d;
  47.         }

  48.        #JS 和 CSS 缓存时间设置
  49.         location ~.*/\.(js|css)?$
  50.         {
  51.             expires 1h;
  52.         }

  53.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  54.         #
  55.         #location ~ \.php$ {
  56.         #    proxy_pass   http://127.0.0.1;
  57.         #}

  58.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  59.         #
  60.         #location ~ \.php$ {    #PHP 脚本请求全部转发到 FastCGI 处理. 使用 FastCGI 默认配置
  61.         #    root           html;
  62.         #    fastcgi_pass   127.0.0.1:9000;
  63.         #    fastcgi_index  index.php;
  64.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  65.         #    include        fastcgi_params;
  66.         #}

  67.         # deny access to .htaccess files, if Apache's document root
  68.         # concurs with nginx's one
  69.         #
  70.         #location ~ /\.ht {    #禁止访问 .htaccess 文件
  71.         #    deny  all;
  72.         #}
  73.     }


  74.     # another virtual host using mix of IP-, name-, and port-based configuration
  75.     #
  76.     #server {
  77.     #    listen       8000;
  78.     #    listen       somename:8080;
  79.     #    server_name  somename  alias  another.alias;

  80.     #    location / {
  81.     #        root   html;
  82.     #        index  index.html index.htm;
  83.     #    }
  84.     #}


  85.     # HTTPS server
  86.     #
  87.     #server {
  88.     #    listen       443 ssl;
  89.     #    server_name  localhost;

  90.     #    ssl_certificate      cert.pem;
  91.     #    ssl_certificate_key  cert.key;

  92.     #    ssl_session_cache    shared:SSL:1m;
  93.     #    ssl_session_timeout  5m;

  94.     #    ssl_ciphers  HIGH:!aNULL:!MD5;
  95.     #    ssl_prefer_server_ciphers  on;

  96.     #    location / {
  97.     #        root   html;
  98.     #        index  index.html index.htm;
  99.     #    }
  100.     #}

  101. }
复制代码
4、发布您的网站:
      将您网站带有 index.html 文件的目录下的所有文件、目录拷贝到 nginx\html 目录下

5、浏览网站:
       双击 x:\Program Files\nginx\nginx.exe 启动 Nginx

       在 FireFox 或 IE 浏览器中键入 http://localhost/http://127.0.0.1/  (或服务器 IP 地址),浏览您的网站;

版权声明:
本文为独家原创稿件,版权归 德云社区,未经许可不得转载;否则,将追究其法律责任。


路过

雷人

握手

鲜花

鸡蛋
AI人工智能 语音助理 人工翻译 教程

相关阅读

发表评论

最新评论

引用 liangsheng 2014-12-26 00:30
Nginx, Ubuntu, html, POP3, SMTP



引用 liangsheng 2014-12-26 00:30
Nginx, Ubuntu, html, POP3, SMTP

查看全部评论(2)

CSS3 官方中文文档编制 手册教程 人工翻译 更新日志
CSS3 官方中文文档编制 手册教程 人工翻译 更新日志 CSS3 中文文档编制采用机器辅助 + 全人工翻译,完全采用 数字翻译 的文档翻译流程进行汉化 (未采用任何第 3 方工具),[904/2022-07-31]
CSS3 官方中文文档编制 手册教程 帮助文件 人工翻译
CSS3 官方中文文档编制 手册教程 帮助文件 人工翻译 CSS3 中文文档编制采用机器辅助 + 全人工翻译,完全采用 数字翻译 的文档翻译流程进行汉化 (未采用任何第 3 方工具),[1012/2022-07-31]
SolidWorks 2020 非对称Conic Rho圆角 抽壳出现模型穿刺
SolidWorks 2020 非对称Conic Rho圆角 抽壳出现模型穿刺 标准对称圆角最常用,但有时偶尔也会用到非对称圆角。 特别是模具、五金、电子、手饰、汽车、家具、玩具、等对圆[887/2022-05-25]
NumPy 1.22 官方中文文档编制 手册帮助 更新日志
NumPy 1.22 官方中文文档编制 手册帮助 更新日志 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 NumPy 1.22。 NumPy 1.22 中文文档编制采用[579/2022-05-22]
NumPy 1.22 官方中文文档编制 手册帮助 全人工翻译
NumPy 1.22 官方中文文档编制 手册帮助 全人工翻译 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 NumPy 1.22。 NumPy 1.22 中文文档编制采[654/2022-05-22]
Pillow 9.1.1 官方中文文档编制 手册帮助 更新日志
Pillow 9.1.1 官方中文文档编制 手册帮助 更新日志 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 Pillow 9.1.1。 Pillow 9.1.1 中文文档编[623/2022-05-22]
Pillow 9.1.1 官方中文文档编制 手册帮助 全人工翻译
Pillow 9.1.1 官方中文文档编制 手册帮助 全人工翻译 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 Pillow 9.1.1。 Pillow 9.1.1 中文文档[576/2022-05-22]
PyMuPDF 1.19.6 官方中文文档编制 手册帮助 更新日志
PyMuPDF 1.19.6 官方中文文档编制 手册帮助 更新日志 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 PyMuPDF 1.19.6。 PyMuPDF 1.19.6 中文[1158/2022-05-22]
PyMuPDF 1.19.6 官方中文文档编制 手册帮助 全人工翻译
PyMuPDF 1.19.6 官方中文文档编制 手册帮助 全人工翻译 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 PyMuPDF 1.19.6。 PyMuPDF 1.19.6 中[992/2022-05-22]
Qt 6.3.0 官方中文文档编制 手册教程 帮助文件 人工翻译
Qt 6.3.0 官方中文文档编制 手册教程 帮助文件 人工翻译 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 Qt 6.3.0。 Qt 6.3.0 中文文档编制[2442/2022-05-02]
Qt 6.3.0 官方中文文档编制 手册教程 人工翻译更新日志
Qt 6.3.0 官方中文文档编制 手册教程 人工翻译更新日志 以后不再上传 en-US 官方原版文档编制,目前上传的最新 zh-CN 人工翻译版本为 Qt 6.3.0。 Qt 6.3.0 中文文档编制采[2027/2022-05-02]
MAGIX Music Maker Premium - 易学易用 功能强大的可视化编曲软件
MAGIX Music Maker Premium - 易学易用 功能强大的可视化编曲软件 MAGIX Music Maker 是德国 Magix 出品的可视化编曲软件,功能强大、使用简单、容易上手。 MAGIX Music Ma[1736/2022-04-11]
MQTT - 消息队列遥测技术 M2M机器到机器 IoT物联网 通信协议
MQTT - 消息队列遥测技术 M2M机器到机器 IoT物联网 通信协议 MQTT 是 Message Queuing Telemetry Transport 的缩写,中文译为消息队列遥测传输。 MQTT 是 ISO 标准 (ISO/I[614/2022-02-24]
数字 Python IDE 2022 注册机 注册码生成器 附详细破解方法
数字 Python IDE 2022 注册机 注册码生成器 附详细破解方法 数字 Python IDE 目前还在不断研发 进步中,虽不太成熟,但其新理念很有特色 特别适于多版本 多文档 多工程并行[678/2022-02-01]
数字翻译 2022 注册机 注册码生成器 内存破解器 附详细用法
数字翻译 2022 注册机 注册码生成器 内存破解器 附详细用法 数字翻译目前还在不断研发 进步中,虽不太成熟,但其新理念很有特色 特别适于 HTML 文档本地化 (面向高精度 超[631/2022-02-01]

Archiver|Sitemap|小黑屋|德云社区   

GMT+8, 2024-4-26 02:54 , Processed in 0.028305 second(s), 28 queries .

工业和信息化部: 粤ICP备14079481号-2

技术支持 乐数软件     版权所有 © 2014-2021 德云社区    

返回顶部