0% found this document useful (0 votes)
122 views

(CENTOS7) Laravel + CakePHP On Nginx With PHP7.4 & PHP-FPM7.4

The document provides instructions for configuring several services on a CentOS 7 server including: 1. Disabling SELinux and configuring SSH to disable root login and add port and user restrictions. 2. Configuring vsftpd to disable anonymous access. 3. Installing Nginx and configuring it to serve content from the /home/web directory and enable PHP processing. 4. Installing PHP 7.4, composer, and configuring PHP-FPM to work with Nginx. 5. Installing Laravel and configuring Nginx to serve the Laravel public directory. 6. Installing CakePHP with Composer and config
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

(CENTOS7) Laravel + CakePHP On Nginx With PHP7.4 & PHP-FPM7.4

The document provides instructions for configuring several services on a CentOS 7 server including: 1. Disabling SELinux and configuring SSH to disable root login and add port and user restrictions. 2. Configuring vsftpd to disable anonymous access. 3. Installing Nginx and configuring it to serve content from the /home/web directory and enable PHP processing. 4. Installing PHP 7.4, composer, and configuring PHP-FPM to work with Nginx. 5. Installing Laravel and configuring Nginx to serve the Laravel public directory. 6. Installing CakePHP with Composer and config
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DISABLE SELINUX CENTOS7

1. vi /etc/selinux/config
SELINUX=disabled
2. reboot

#KONFIGURASI SSH CENTOS7

1. Pastikan SSH sudah terinstall


2. vi /etc/ssh/sshd_config
- Aktifkan Port 22
- Aktifkan MaxAuthTries dan MaxSessions ( Rubah sesuai dengan kebutuhan )
- Pastikan PermitRootLogin sudah Mati
- Tambahkan perintah AllowUsers ‘username’ dipaling bawah
3. systemctl restart sshd
4. firewall-cmd –permanent –add-port=22/tcp
5. firewall-cmd –reload

#KONFIGURASI VSFTD CENTOS7

1. Pastikan sudah terhubung ke Internet


2. Yum install vsftpd
3. vi /etc/vsftpd/vsftpd.conf
- Matikan anonymous_enable=YES
4. systemctl start vsftpd
systemctl enable vsftpd
#INSTALL 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 , 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"';

access_log /var/log/nginx/access.log main;

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 {
}

error_page 500 502 503 504 /50x.html;


location = /50x.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

#PHP7.4 PHP-FPM CENTOS7

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. yum install php-cli php-zip wget unzip


2. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
3. HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
4. php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; }
else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
5. php composer-setup.php --install-dir=/usr/local/bin --filename=composer
6. cek composer

#INSTALL LARAVEL ON NGINX 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;

# Log files for Debugging


access_log /var/log/nginx/laravel-access.log;
error_log /var/log/nginx/laravel-error.log;

# Webroot Directory for Laravel project


root /home/web/laravel/public;
index index.php index.html index.htm;

# Your Domain Name


server_name localhost;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

# PHP-FPM Configuration Nginx


location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

12. Systemctl restart nginx


13. Sytemctl restart php-fpm

#INSTALL PHPCAKE WITH NGINX ON CENTOS7

1. yum install php-intl php-mbstring php-mysql php-simplexml


2. cd /home/web
3. composer create-project --prefer-dist cakephp/cakephp
4. ketika ditanya Default = yes
5. chown -R root:nginx /home/web/cakephp
6. chmod -R 775 /home/web/cakephp
7. nano /home/web/cakephp/config/app_local.php
rubah __SALT__ , sesuai keiginan, dan isi konfig database pada Datasources
8. nano /etc/nginx/conf.d/cakephp.conf
9. isi seperti dibawah

server {
listen 81;
server_name localhost;

# Log files for Debugging


access_log /var/log/nginx/cake-access.log;
error_log /var/log/nginx/cake-error.log;

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;
}
}

10. firewall-cmd –permanent –add-port=81/tcp


11. firewall-cmd –reload
12. nano /etc/php.ini
tambahkan extension=intl.so
13. systemctl restart nginx
14. systemctl restart php-fpm
15. coba buka port :81

You might also like