linux无网络情况下安装nginx

由于机房部署的严密性,是不能访问外网的,只能用光盘刻录的形式携带进去。

所以之前的nginx安装文档在此不适应。
https://blog.csdn.net/huangbaokang/article/details/79917964

因不能访问外网,所以yum安装是不支持的

准备好rpm包
rpm下载地址http://nginx.org/packages/rhel/7/x86_64/RPMS/nginx-1.10.3-1.el7.ngx.x86_64.rpm
因为rpm包的安装不像yum安装那样需要把依赖gcc zlib zlib-devel pcre-devel openssl openssl-devel都安装进去。

安装步骤

[root@localhost nginx]# pwd
/root/nginx
[root@localhost nginx]# ls
nginx-1.10.3-1.el7.ngx.x86_64.rpm
[root@localhost nginx]# rpm -ivh nginx-1.10.3-1.el7.ngx.x86_64.rpm 
警告:nginx-1.10.3-1.el7.ngx.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 7bd9bf62: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:nginx-1:1.10.3-1.el7.ngx         ################################# [100%]
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------

启动nginx

[root@localhost nginx]# /usr/sbin/nginx -c /etc/nginx/nginx.conf
[root@localhost nginx]# ps -ef|grep nginx
root      1321     1  0 03:30 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     1322  1321  0 03:30 ?        00:00:00 nginx: worker process
root      1324  1228  0 03:30 pts/0    00:00:00 grep --color=auto nginx

这样就可以通过浏览器访问内网的nginx了

linux无网络情况下安装nginx_第1张图片

停止命令:

[root@localhost nginx]# /usr/sbin/nginx -s stop
[root@localhost nginx]# ps -ef|grep nginx
root      1337  1228  0 03:37 pts/0    00:00:00 grep --color=auto nginx

配置文件检查

[root@localhost nginx]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

重启nginx

[root@localhost nginx]# /usr/sbin/nginx -s reload

你可能感兴趣的:(linux)