CentOS 7 – Install nginx web server

nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server

To add nginx yum repository, create a file named /etc/yum.repos.d/nginx.repo and paste one of the configurations below:

name=nginx repo

Use following command to install nginx

# yum install nginx

# systemctl start nginx

# systemctl status nginx
nginx.service – nginx – high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled)
Active: active (running) since Sun 2015-04-26 00:53:23 EDT; 3s ago
Docs: http://nginx.org/en/docs/
Process: 21459 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Process: 21457 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 21461 (nginx)
CGroup: /system.slice/nginx.service
??21461 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
??21462 nginx: worker process

Apr 26 00:53:23 example.com nginx[21457]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Apr 26 00:53:23 example.com systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
Apr 26 00:53:23 example.com systemd[1]: Started nginx – high performance web server.

# systemctl enable nginx.service
ln -s ‘/usr/lib/systemd/system/nginx.service’ ‘/etc/systemd/system/multi-user.target.wants/nginx.service’

To support PHO, next is to install PHP through PHP-FPM (PHP-FPM (FastCGI Process Manager)

yum install php-fpm php-mysql php-cli

Edit /etc/php.ini
set cgi.fix_pathinfo=0

# systemctl start php-fpm.service

# systemctl enable php-fpm.service

Posted in Security Tagged with: ,

Leave a Reply