Tuesday, April 21, 2015

Tutorial Ubuntu Migrasi Web Server Apache ke NGINX


Migrasi Web Server Apache ke NGINX
sudo apt-get purge apache2*
sudo apt-get autoremove -y
install nginx
sudo apt-get install nginx
start nginx
sudo service nginx start
test nginx di browser point to http://localhost/ atau http://ipserver
install php 5
sudo apt-get install php5 php5-fpm
configure php 5
sudo nano /etc/php5/fpm/php.ini
cari baris cgi.fix_pathinfo=1; uncomment
cgi.fix_pathinfo=0
restart php5-fpm
sudo service php5-fpm restart

Test PHP

buat file testphp.php
sudo nano /usr/share/nginx/html/testphp.php
masukan script berikut

 phpinfo();
?>
selanjut nya buka url http://localhost/testphp.php nanti muncul configurasi php informasi
PHP-FPM listens on the socket /var/run/php5-fpm.sock by default. If you want to make PHP-FPM use a TCP connection, open the file /etc/php5/fpm/pool.d/www.conf,
sudo nano /etc/php5/fpm/pool.d/www.conf
cari baris listen = /var/run/php5-fpm.sock uncomment dan tambahkan
listen = 127.0.0.1:9000
configure nginx
location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.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;
                fastcgi_index index.php;
                include fastcgi.conf;
        }

No comments: