Catalogue
Installing Nginx on CentOS7

Installing Nginx on CentOS7

🌐 日本語で読む

I wrote this down for setting up Kibana.

Environment

  • CentOS7

Installing Nginx

  • Create the repository for Nginx
1
# vim /etc/yum.repos.d/nginx.repo
  • Add the following
1
2
3
4
5
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

Installing the Nginx module

1
$ sudo yum install --enablerepo=nginx nginx
Registering the service

Configure Nginx to start when the server boots or reboots.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ sudo systemctl disable httpd
$ sudo systemctl enable nginx
$ sudo systemctl start nginx
$ systemctl status nginx

nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: active (running) since Mon 2015-08-03 06:07:44 UTC; 2s ago
Docs: http://nginx.org/en/docs/
Process: 12642 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Process: 12641 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 12645 (nginx)
CGroup: /system.slice/nginx.service
├─12645 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx....
└─12646 nginx: worker process

Aug 03 06:07:44 ip-172-31-19-253 systemd[1]: Starting nginx - high performan....
Aug 03 06:07:44 ip-172-31-19-253 nginx[12641]: nginx: the configuration file...k
Aug 03 06:07:44 ip-172-31-19-253 nginx[12641]: nginx: configuration file /et...l
Aug 03 06:07:44 ip-172-31-19-253 systemd[1]: Failed to read PID from file /r...t
Aug 03 06:07:44 ip-172-31-19-253 systemd[1]: Started nginx - high performanc....
Hint: Some lines were ellipsized, use -l to show in full.

Verifying access

http://

If you see something like the following, you are good to go.

That’s all.

Author

Kenzo Tanaka

Posted on

2015-08-20

Licensed under