Professional Documents
Culture Documents
(CENTOS7) Nginx-PHP7-PostgreSQL-MariaDB-phpMyAdmin
(CENTOS7) Nginx-PHP7-PostgreSQL-MariaDB-phpMyAdmin
1. vi /etc/selinux/config
SELINUX=disabled
2. reboot
1. yum update
2. yum install epel-release
3. yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
4. vi /etc/yum.repos.d/remi-php73.repo
- [remi-php73]
- enabled=1
5. yum install php php-fpm
6. vi /etc/php.ini
- cgi.fix_pathinfo=1
- upload_max_filesize = 500M
- post_max_size = 500M
7. vi /etc/php-fpm.d/www.conf
- user = nginx
- group = nginx
- listen = 127.0.0.1:6000 ( Ubah Port sesuai keubutuhan )
8. systemctl start php-fpm ( akan terjadi error karena user/group nginx belum terinstall )
9. systemctl enable php-fpm
#NGINX CENTOS7
1. yum update
2. yum install epel-release
3. yum install nginx
4. systemctl start nginx
5. systemctl enable nginx
6. vi /etc/nginx/nginx.conf , hapus semua konfigurasi awalnya lalu copas conf dibawa taro di
nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
index index.php index.html index.htm;
client_max_body_size 100M;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
}
7. cd /home
8. mkdir web
9. chown -R usernamekalian:nginx /home/web
10. chmod +x -R /home/web
11. cd /etc/nginx/conf.d/
12. nano default.conf , copas conf dibawah
server {
listen 80;
server_name ipaddress;
root /home/web/;
location / {
index index.php index.html index.htm;
if (-f $request_filename) {
expires 30d;
break;
}
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:6000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 8080;
root /usr/share/phpMyAdmin/;
include /etc/nginx/default.d/*.conf;
location / {
try_files $uri $uri/ /index.php?q=$request_uri; }
client_max_body_size 100M;
error_page 404 /404.html;
location = /40x.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /usr/share/phpMyAdmin;
fastcgi_pass 127.0.0.1:6000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_read_timeout 500;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;}
}
13. systemctl restart nginx
14. systemctl restart php-fpm
15. systemctl restart mariadb
16. firewall-cmd –permanent –add-port=8080/tcp
17. firewall-cmd –reload
18. chown -R nginx:nginx /var/lib/php/session/