赞
踩
yum -y install epel-release
出现epel源
[root@localhost yum.repos.d]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Media.repo epel.repo
CentOS-CR.repo CentOS-Sources.repo epel-testing.repo
CentOS-Debuginfo.repo CentOS-Vault.repo
CentOS-fasttrack.repo CentOS-x86_64-kernel.repo
yum -y install nginx
rpm -uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
修改yum源
vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx.repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
systemctl start nginx.service
systemctl enable nginx.service
检查安装版本
nginx -v
重启
/usr/sbin/nginx -s stop
/usr/sbin/nginx -s reload
配置文件位置:
/etc/nginx
[root@localhost yum.repos.d]# ls /etc/nginx
conf.d koi-utf scgi_params
default.d koi-win scgi_params.default
fastcgi.conf mime.types uwsgi_params
fastcgi.conf.default mime.types.default uwsgi_params.default
fastcgi_params nginx.conf win-utf
fastcgi_params.default nginx.conf.default
查看nginx.conf主配置文件
查找默认的安装位置
find / -name *nginx* [root@localhost /]# find / -name *nginx* /run/nginx.pid /sys/fs/cgroup/systemd/system.slice/nginx.service /etc/systemd/system/multi-user.target.wants/nginx.service /etc/systemd/system/nginx.service.d /etc/logrotate.d/nginx /etc/nginx /etc/nginx/nginx.conf /etc/nginx/nginx.conf.default /var/tmp/systemd-private-9fbd51e7c0714a37bc28f8f7aee49468-nginx.service-CmQIIT /var/lib/yum/yumdb/n/f8a4655b1aa3ca9c0275be2d64ea287e99fc7217-nginx-filesystem-1.20.1-9.el7-noarch /var/lib/yum/yumdb/n/85502cf4b35f5368569b0b62e550755496b72249-nginx-1.20.1-9.el7-x86_64 /var/lib/nginx /var/log/nginx /tmp/systemd-private-9fbd51e7c0714a37bc28f8f7aee49468-nginx.service-szPRoy /usr/bin/nginx-upgrade /usr/sbin/nginx /usr/lib/systemd/system/nginx.service /usr/lib/systemd/system/nginx.service.d /usr/lib64/nginx /usr/share/doc/nginx-1.20.1 /usr/share/licenses/nginx-1.20.1 /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx-upgrade.8.gz /usr/share/man/man8/nginx.8.gz /usr/share/nginx /usr/share/nginx/html/nginx-logo.png /usr/share/vim/vimfiles/ftdetect/nginx.vim /usr/share/vim/vimfiles/ftplugin/nginx.vim /usr/share/vim/vimfiles/indent/nginx.vim /usr/share/vim/vimfiles/syntax/nginx.vim
[root@localhost /]# cat /etc/systemd/system/multi-user.target.wants/nginx.service [Unit] Description=The nginx HTTP and reverse proxy server After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/run/nginx.pid # Nginx will fail to start if /run/nginx.pid already exists but has the wrong # SELinux context. This might happen when running `nginx -t` from the cmdline. # https://bugzilla.redhat.com/show_bug.cgi?id=1268621 ExecStartPre=/usr/bin/rm -f /run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/usr/sbin/nginx -s reload KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=process PrivateTmp=true [Install] WantedBy=multi-user.target
可以发现安装到了/usr/sbin/nginx下
[root@localhost /]# cat /etc/nginx/nginx.conf # 运行用户 user nginx; # 启动进程 一般与cpu数量相等 worker_processes auto; # 全局错误日志 error_log /var/log/nginx/error.log; # 进程日志文件位置 pid /run/nginx.pid; # 包含了子配置文件 include /usr/share/nginx/modules/*.conf; # 工作模式以及链接上限 events { use epoll; #epoll 是多路复用,IO模型中的一种&#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。