test nginx with php [raspberrypi]

based on:
http://workshop.botter.ventures/2013/09/05/how-to-setup-a-web-server-with-nginxphp-on-raspberry-pi/

sudo mkdir -p /var/www
sudo service nginx stop
sudo unlink /etc/nginx/sites-enabled/default

sudo nano /etc/nginx/sites-available/mysite

server {
        listen 80;
        root /var/www;
        index index.html index.htm;
}

cd /etc/nginx/sites-enabled
sudo ln -s ../sites-available/mysite
sudo service nginx start

test:
http://localhost:5080/ not :80 ?!?

sudo apt-get install php5-fpm php-apc

sudo service php5-fpm restart

sudo nano /etc/nginx/sites-available/mysite

server {
        listen 80;
        root /var/www;
        index index.php index.html index.htm;

        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

sudo nano /var/www/test.php

<?php
        phpinfo();
?>

sudo service nginx restart

test:
http://localhost:5080/test.php

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s