sudo yum install epel-releaseJika sudah selesai install Nginx dengan command :
sudo yum install nginx -yUntuk menyalakan nginx, ketik command
sudo systemctl start nginxBiasanya jika url / IP masih belum bisa menampilkan halaman hello world Nginx, anda harus menambahkan by pass firewall dengan command ini.
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reloadJika sudah, anda harusnya sudah bisa melihat Welcome to Nginx
sudo systemctl enable nginx
sudo yum install mariadb-server mariadb -y #untuk menjalankan sudo systemctl start mariadb # untuk auto start sudo systemctl enable mariadbMysql sudah berjalan, maka jalankan command ini untuk setup master password
sudo mysql_secure_installation
sudo yum install php php-mysql php-fpmJika sudah, jalankan
sudo nano /etc/php.inidi config ini ubah parameter agar sama seperti ini
cgi.fix_pathinfo=0Lanjut ke
/etc/php-php.d/www.confubah 3 param berikut:
#1 listen = /var/run/php-fpm/php-fpm.sock #2 listen.owner = nobody listen.group = nobody #3 user = nginx group = nginxJika sudah maka
sudo systemctl start php-fpm sudo systemctl enable php-fpmLanjut
sudo nano /etc/nginx/conf.d/default.confJika sudah maka restart nginx
sudo systemctl restart nginxUntuk mengetes, buka
sudo nano /usr/share/nginx/html/info.phpdan isi dengan
phpinfo();
/usr/share/nginx/htmldengan Lokasi conf.d di
/etc/nginx/conf.dUntuk pengaturan conf global nginx ada di
/etc/nginx/nginx.confUntuk codeigniter,
server {
listen 80 default_server;
#listen 443 ssl;
listen [::]:80 default_server;
server_name testing.muahunter.com;
error_log /var/log/nginx/error_nginx.log;
# set client body size to 10M
# client_max_body_size 10M;
#ssl on;
#ssl_certificate /etc/nginx/ssl/muahunter.com.chained.crt;
#ssl_certificate_key /etc/nginx/ssl/muahunter.com.key;
#set session timeout ssl
#ssl_session_cache shared:SSL:20m;
#ssl_session_timeout 10m;
# Load configuration files for the default server block. include /etc/nginx/defa$ # session security ssl
#add_header Strict-Transport-Security "max-age=31536000";
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root /usr/share/nginx/html;
index index.php index.html index.htm;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;
try_files $uri $uri/ /index.php;
}
# force https-redirects
#if ($scheme = http) {
# return 301 https://$host$request_uri;
#} #location ~ \.php {
# include /etc/nginx/common/php.conf;
#}
#sementara jangan pake dlu
#error_page 404 /404.html;
# location = /40x.html {
#} error_page 500 502 503 504 /50x.html;
location = /50x.html { }
}
systemctl reload sshd
adalah kumpulan tutorial server dan pemograman tentang seputar Linux & PHP
CodeIgniter