1. 下载
目前(2015-07-11),nginx的稳定版本是1.8.0,在官网下载先,windows版的nginx1.8.0
这是一个zip文件,解压后即可使用
2. 启动
绿色文件,无须安装,直接即可启动。
据我所知,3种启动途径,其实都类似:
一、双击nginx.exe图标,可见黑窗口一闪而过,启动完毕。
二、命令行到nginx目录,输入nginx启动。(注,此方式命令行窗口无任何提示,且被锁定)
三、命令行到nginx目录,输入start nginx启动,此方式不锁定
启动后,默认情况下(无修改配置),可见到有两个nginx的进程,1个是master process,1个是worker processes。
如果你在配置中配置2个worker_processes,进程中就可以看到1个是master process,2个是worker processes。
3. 测试
默认nginx部署了些静态内容,我们可通过它测试nginx是否在工作。
默认的配置文件(NGINX_HOME/conf/nginx.conf)如下:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# 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 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
通过观察配置文件的非注释项(参考Nginx配置文件nginx.conf中文详解),大概可知:
1、启动了1个worker processes
2、worker_connections,最大并发数为1024
3、include mime.types,引入mime.types文件所声明的文件扩展名与文件类型映射
4、application/octet-stream,默认使用application/octet-stream
5、sendfile,开启高效文件传输模式
6、监听本机“localhost”的80端口
7、映射目录为“当前目录的html目录”
8、出现500、502、503、504错误,则映射到50x.html
浏览地址http://localhost,即可访问其默认页面,即映射到NGINX_HOME/html/index.html
其他静态内容,如html、图片,可自行添加测试。
4. 日志
日志默认位于NGINX_HOME/logs/,可见:
1、access.log,访问日志
2、error.log,异常日志
3、nginx.pid,进程(仅在启动nginx后才有此日志)
5. CentOS下Nginx的安装
tar -zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0 ./configure make make install /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
安装完毕,查看进程及相关日志:
ps -ef | grep nginx less /usr/local/nginx/logs/error.log less /usr/local/nginx/logs/nginx.pid less /usr/local/nginx/logs/access.log
相关推荐
在完全无互联网连接的情况下,离线安装nginx。 nginx版本号:nginx-1.20.1-2.el7.x86_64 食用方法: 1.解压 2.进入解压目录 3.rpm安装全部 4.安装完成
Centos7.6.1810离线安装Nginx-所需依赖包 1、patch命令:patch-2.7.1-12.el7_7.x86_64.rpm 2、zlib-1.2.12.tar.gz 3、zlib-devel-1.2.7-20.el7_9.x86_64.rpm 4、pcre-8.32-17.el7.x86_64.rpm 5、pcre-devel-8.32-17....
很难找的 centos7 nginx-1.6.2-1.el7.centos.ngx.x86_64.rpm 包
nginx官网不再更新centos6版,此rpm构建于nginx最新稳定版1.24.0
2022年5月30日 官方当前最新稳定版本nginx 二进制rpm包 适用于x86架构centos7 rhel7版本操作系统升级安装nginx 该包开启了ipv6支持,添加了nginx-rtmp模块支持
包含nginx-1.14.2安装包及依赖包,直接上传安装即可使用,依赖包含有 gcc、zlib、pcre、openssl;若果需要实现负载均衡直接将文件夹下的nginx.conf上传是安装目录下的src目录下替换稍作修改即可,包中有详细安装配置...
"CentOS 7.4 下安装 Nginx 1.16.0" 在 CentOS 7.4 操作系统中安装 Nginx 1.16.0 需要遵循以下步骤: 一、下载 Nginx 安装包 首先,需要切换到 `/usr/local` 目录下,然后下载 Nginx 1.16.0 的安装包。可以使用 ...
通过Dockerfile创建 基于Centos7.8.2003基础镜像搭建nginx-rtmp-ffmpeg流服务镜像
rpm -Uvh --force --nodeps *.rpm centos nginx-1.16.1离线安装包
linux离线安装nginx-centos x86-64
centos源码安装nginx-1.20.2+nginx负载均衡
nginx-1.18.0-1.el7.ngx.x86_64 nginx离线安装包 免积分下载 centos亲测可用 免积分,不像博客中一部分人高积分下载下来没有用。
nginx-1.21.6,libtool-2.4.2,pcre-8.35,gcc,gcc-c++。Centos7安装依赖包,rpm安装包,离线安装,
2023年5月26日,当前最新稳定版nginx 1.24.0 二进制rpm包 适用于arm64架构平台,centos7 redhat 7 arm架构的操作系统 已开启ipv6支持,官方默认不支持 可用于修复安全漏洞、升级更新nginx版本到1.24.0
2023年5月26日,当前最新稳定版本nginx 1.24.0 已开启ipv6支持 二进制rpm包 适用于centos7 redhat 7系列的操作系统使用 适用于x86架构 主要修复安全漏洞、升级更新nginx版本,增强web服务器安全性
CentOS下nginx服务安装包,直接yum即可完成安装。Nginx (engine x) 是一个高性能的HTTP和web服务器,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рам...
centos7离线部署nginx-docker,需要的可以下载免费公开,记录自己的一次学习 centos7离线部署nginx-docker,需要的可以下载免费公开,记录自己的一次学习
nginx--centos6.5(日志功能)安装文档以及安装文件,解决日志记录中文乱码问题
nginx1.23.2-麒麟-aarch64
CentOS下nginx服务安装包,直接yum即可完成安装。Nginx (engine x) 是一个高性能的HTTP和web服务器,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рам...