首页 技术 正文
技术 2022年11月12日
0 收藏 397 点赞 3,235 浏览 1568 个字

nginx安装及启动

1.用yum源安装,首先配置yum源 在“/etc/yum.repo.d/”下创建yum源文件

例如:cd /etc/yum.repo.d/nginx.repo

[nginx-stable]

name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

2.查看yum源包

  yum info nginx 查看nginx安装包源信息版本等

  yum install nginx  安装yum源安装包

  安装完成后用”nginx -h” 查看nginx应用的命令

[root@ ~]# nginx -h
nginx version: nginx/1.16.
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /etc/nginx/)
-c filename : set configuration file (default: /etc/nginx/nginx.conf)
-g directives : set global directives out of configuration file

3.用”nginx”命令启动nginx服务

启动服务后用命令ss -ntlp查看端口和服务的情况

[root@ ~]# ss -ntlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN *: *:* users:(("rpcbind",pid=,fd=))
LISTEN 0 128 *:80 *:* users:(("nginx",pid=6044,fd=6),("nginx",pid=6043,fd=6),("nginx",pid=5797,fd=6))
LISTEN 192.168.122.1: *:* users:(("dnsmasq",pid=,fd=))
LISTEN *: *:* users:(("sshd",pid=,fd=))
LISTEN 127.0.0.1: *:* users:(("cupsd",pid=,fd=))
LISTEN 127.0.0.1: *:* users:(("sshd",pid=,fd=))
LISTEN ::: :::* users:(("rpcbind",pid=,fd=))
LISTEN ::: :::* users:(("sshd",pid=,fd=))
LISTEN ::: :::* users:(("cupsd",pid=,fd=))
LISTEN ::: :::* users:(("sshd",pid=,fd=))

4.再开通防火墙和80端口即可

 firewall-cmd --zone=public --add-port=/tcp --permanent
firewall-cmd --reload

5用其他主机访问IP地址即可

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,488
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,903
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,737
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,489
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,128
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,290