(CENTOS7) Laravel + CakePHP On Nginx With PHP7.4 & PHP-FPM7.4
(CENTOS7) Laravel + CakePHP On Nginx With PHP7.4 & PHP-FPM7.4
1. vi /etc/selinux/config
SELINUX=disabled
2. reboot
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 , copas conf dibawa taro di nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
#pid /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;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /home/web;
index index.php index.html;
include /etc/nginx/default.d/*.conf;
location / {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
7. cd /home
8. mkdir web
9. chown -R usernamekalian:nginx /home/web
10. chmod +x -R /home/web
11. nano /home/web/index.php
lalu isi <?php phpinfo(); ?>
12. firewall-cmd –permanent –add-port=80/tcp
13. firewall-cmd –reload
14. systemctl restart nginx
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-php74.repo
- [remi-php74]
- 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:9000 ( Ubah Port sesuai keubutuhan )
8. systemctl start php-fpm
9. systemctl enable php-fpm
10. systemctl restart nginx
11. cek infophp
#INSTALL COMPOSER & CONFIGURE CENTOS7
1. cd /home/web
2. yum install -y php-curl php-common php-cli php-mysql php-mbstring php-xml php-pdo php-zip
3. composer create-project laravel/laravel
4. cd /home/web/laravel
5. chmod -R 777 storage
6. chmod -R 777 bootstrap/cache
7. chown -R root:nginx /home/web/laravel
8. php artisan key:generate
9. php artisan --version
10. nano /etc/nginx/conf.d/laravel.conf
11. Isi Seperti dibawah ini
server {
listen 80;
listen [::]:80 ipv6only=on;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
server {
listen 81;
server_name localhost;
root /home/web/cakephp/webroot;
index index.php index.html;
location / {
try_files $uri $uri?$args $uri/ /index.php?$uri&$args /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}