Chat with us
Subscribe
Dapatkan berita terbaru seputar startup dan inspirasi technopreneurship dengan berlangganan newsletter Grevia.

 

Server Centos 7

Lakukan update repository Linux
sudo yum install epel-release
Jika sudah selesai install Nginx dengan command :
sudo yum install nginx -y
Untuk menyalakan nginx, ketik command
sudo systemctl start nginx
Biasanya 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 --reload
Jika sudah, anda harusnya sudah bisa melihat Welcome to Nginx
Jangan lupa untuk membuat service nginx autostart setiap kali ada shutdown / reboot dengan command:
sudo systemctl enable nginx

Install MariaDB / Mysql

Lokasi konfigurasi server ada di
sudo yum install mariadb-server mariadb -y 

#untuk menjalankan
sudo systemctl start mariadb

# untuk auto start 
sudo systemctl enable mariadb
Mysql sudah berjalan, maka jalankan command ini untuk setup master password
sudo mysql_secure_installation

Install PHP

Untuk menginstal PHP dan Php-Fpm
sudo yum install php php-mysql php-fpm
Jika sudah, jalankan
sudo nano /etc/php.ini
di config ini ubah parameter agar sama seperti ini
cgi.fix_pathinfo=0
Lanjut ke
/etc/php-php.d/www.conf 
ubah 3 param berikut:
#1
listen = /var/run/php-fpm/php-fpm.sock

#2
listen.owner = nobody
listen.group = nobody

#3
user = nginx
group = nginx
Jika sudah maka
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
Lanjut
sudo nano /etc/nginx/conf.d/default.conf
Jika sudah maka restart nginx
sudo systemctl restart nginx
Untuk mengetes, buka
sudo nano /usr/share/nginx/html/info.php
dan isi dengan
phpinfo();

Install Php Fpm

Lokasi konfigurasi server ada di
/usr/share/nginx/html
dengan Lokasi conf.d di
/etc/nginx/conf.d
Untuk pengaturan conf global nginx ada di
/etc/nginx/nginx.conf
Untuk 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 {    }
}

Reload ssh

systemctl reload sshd
Copyright © 2011 - 2025. Grevia Networks
×