yum info nginx
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd 2 packages excluded due to repository priority protections Error: No matching Packages to list
yum repository에 nginx가 없어서 에러가 발생한다.
sudo vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
붙여 넣고 저장한다.
yum info nginx
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
2 packages excluded due to repository priority protections
Available Packages
Name : nginx
Arch : x86_64
Epoch : 1
Version : 1.16.1
Release : 1.el7.ngx
Size : 766 k
Repo : nginx/x86_64
Summary : High performance web server
URL : http://nginx.org/
License : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
: a mail proxy server.
sudo yum install nginx
nginx -v
nginx 기동
sudo systemctl start nginx
nginx 중지
sudo systemctl stop nginx
nginx 확인
sudo systemctl status nginx
ps -ef | grep nginx
웹서비스 확인
기본 설정 파일
sudo find / -name nginx.conf
/etc/nginx/nginx.conf
sudo vi /etc/nginx/nginx.conf
nginx.conf를 보면 아래의 default.conf 파일은 include 되어있다.
sudo vi /etc/nginx/conf.d/default.conf
확인해보자
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/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 /usr/share/nginx/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;
#}
}
출처