Centos 7 + NginX 설치 + PHP5
Server 관리/Apache,Tomcat,NginX,WS,WASNGINX -----------------------------------------------------------------------------
1) sudo vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
2) yum install -y nginx
3) firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
4) systemctl start nginx
systemctl enable nginx
PHP 5 ------------------------------------------------------------------------------
1) yum install php php-devel php-pear php-mysql php-mbstring php-gd php-imap php-odbc php-xmlrpc php-xml php-fpm
2) vim /etc/php.ini
cgi.fix_pathinfo=0;
3) vim /etc/php-fpm.d/www.conf
listen = /run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
user = nginx
group = nginx
4)
systemctl restart php-fpm
chmod 666 /run/php-fpm/php-fpm.sock
chown nginx:nginx /run/php-fpm/php-fpm.sock
systemctl restart php-fpm
vim /etc/nginx/nginx.conf
vim /etc/nginx/conf.d/default.conf
default.conf 에 추가할 내용)
index index.php index.html index.htm;
server_name your domain name or IP;
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
5) systemctl restart nginx
vim /usr/share/nginx/html/phpinfo.php
'Server 관리 > Apache,Tomcat,NginX,WS,WAS' 카테고리의 다른 글
Install and configure Apache Tomcat 8.5 on RHEL & CentOS7 (0) | 2020.04.09 |
---|---|
Apache vs nginx 성능 비교 (0) | 2020.01.15 |
Apache 와 Tomcat 연동 (0) | 2018.11.01 |
Tomcat 다중 설치 (0) | 2018.11.01 |
CentOS 7 + Tomcat 8 설치 (0) | 2018.11.01 |