0% found this document useful (0 votes)
43 views1 page

Konfigurasi NGinx PHP 7

The document provides instructions for configuring PHP 7 and Nginx on Ubuntu. It instructs the user to edit the nginx.conf file to pass all PHP files to the PHP-FPM server using a unix socket, restart Nginx, and test with a simple PHP file that outputs phpinfo() to confirm the setup is working properly.

Uploaded by

Xt Hash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

Konfigurasi NGinx PHP 7

The document provides instructions for configuring PHP 7 and Nginx on Ubuntu. It instructs the user to edit the nginx.conf file to pass all PHP files to the PHP-FPM server using a unix socket, restart Nginx, and test with a simple PHP file that outputs phpinfo() to confirm the setup is working properly.

Uploaded by

Xt Hash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Almat Situs : http://www.kangdeb.id/2016/03/konfigurasi-php-7-dan-nginx.

html

Mengacu pada posting sebelumnya (baca cara install PHP 7 di Ubuntu 14.04), berikut konfigurasi PHP 7 dan Nginx di Ubuntu.

1. Buka file nginx.conf

sudo vi nginx.conf
atau

sudo vi /etc/nginx/sites-enabled/default

2. Edit file nginx.conf, ubah seperti berikut

# Pass all .php files onto a php-fpm/php-fcgi server.


location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

3. Restart Nginx server

sudo service nginx reload

4. Buat file test.php di folder /var/www/html, isi dengan script berikut

<?php
phpinfo();
?>

5. Jalankan file test.php (http://local-server/test.php), jika tampilan seperti gambar berikut maka berhasil

You might also like