Game Development Reference
In-Depth Information
This is the most basic configuration to serve up some standard HTML markup to any
browser. This can be enough for some people as you can include jQuery into these
files and send AJAX requests to other sites or network locations to get various data
without PHP running on the Pi. Let's enable the site:
cd /etc/nginx/sites-enabled
sudo ln -s ../sites-available/nginpi
sudo service nginx start
1. Create a file named index.html in the /var/www directory.
2.
Place some basic HTML markup into it.
3.
Use a browser on another computer on your network that can access the Pi
on port 80 and browse to it.
4.
You should see your basic web page now.
Restart nginx after each configuration change by typing in the command
line service nginx reload .
Installing PHP
As mentioned before, nginx simply handles web requests as quickly as possible. To
get PHP to work with nginx, we need to install an interface called FastCGI . This will
allow nginx to send requests to PHP and receive and display the response. To help
improve PHP performance, we will also install a PHP extension called Alternative
PHP Cache ( APC ). It is much faster and uses fewer resources than the standard
PHP caching.
After installing, PHP should be running, but we will restart it to make sure all the
extensions were loaded correctly.
apt-get install php5-fpm php-apc
service php5-frmp restart
We need to update the nginx virtual host's configuration file now to tell nginx how to
handle PHP requests. This time, you need to restart nginx after you save the file.
server {
listen 80;
root /var/www/local/web;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
 
Search WWH ::




Custom Search