apt-get install nginx php5-fpm php5-mysql mysql-server
nano /etc/nginx/sites-available/defaultPerhatikan bagian ini
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
Ingat, kasih tanda # pada fastcgi_pass 127.0.0.1:9000; karena bentrok dengan yang dibawahnya
Pastikan konfigurasi nginx.conf betul
root@raspberrypi:/home/pi# nginx -t -c /etc/nginx/nginx.conf
nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:51
nginx: configuration file /etc/nginx/nginx.conf test failed
Kalau salah cek lagi mungkin ada yang keliru dikit, Cek lagi untuk memastikan nginx.conf
root@raspberrypi:/home/pi# nginx -t -c /etc/nginx/nginx.confLalu restart fpm-php nya
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@raspberrypi:/home/pi# /etc/init.d/php5-fpm restartRestart nginx
[ ok ] Restarting php5-fpm (via systemctl): php5-fpm.service.
root@raspberrypi:/home/pi#
root@raspberrypi:/home/pi# /etc/init.d/nginx restart
[ ok ] Restarting nginx (via systemctl): nginx.service.
root@raspberrypi:/home/pi#
Sekarang buat file /var/www/html/info.php yang isinya
<?php phpinfo();?>Lalu buka browser sampai muncul seperti ini.
Selanjutnya bisa anda install wordpress, dll.
Tambahan :
Setting agar tidak bisa upload file dot php untuk menangguangi phpshell dan me-restrict file yang terhiden seperti .htaccess
tambahkan berikut ini pada file /etc/nginx/sites-available/default tadi. Taruh dibawah
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
#
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
0 comments:
Post a Comment