https://elinux.org/api.php?action=feedcontributions&user=Rickb&feedformat=atomeLinux.org - User contributions [en]2024-03-28T09:38:52ZUser contributionsMediaWiki 1.31.0https://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146552RPi Nginx Webserver2012-07-04T22:12:55Z<p>Rickb: /* Appendix 2: Uninstall */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
cd<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo mv nginx.list /etc/apt/sources.list.d<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a warning about un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again. (If you did the package installation in the preceding section, you won't need to do this again. Just remove /etc/apt/sources.list.d/nginx.list to clean up, then <code>sudo apt-get update</code>.)<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /etc/default/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146546RPi Nginx Webserver2012-07-04T22:08:21Z<p>Rickb: /* Nginx Installation from Source Code */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
cd<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo mv nginx.list /etc/apt/sources.list.d<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a warning about un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again. (If you did the package installation in the preceding section, you won't need to do this again. Just remove /etc/apt/sources.list.d/nginx.list to clean up, then <code>sudo apt-get update</code>.)<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146540RPi Nginx Webserver2012-07-04T22:08:10Z<p>Rickb: /* Nginx Installation from Source Code */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
cd<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo mv nginx.list /etc/apt/sources.list.d<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a warning about un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again. (If you did the package installation in the preceding section, you won't need to do this again. Just remove /etc/apt/sources.list.d/nginx.list to clean up, then <code>sudo apt-get update</code>.)<br />
<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146534RPi Nginx Webserver2012-07-04T22:07:18Z<p>Rickb: /* Nginx Installation from Source Code */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
cd<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo mv nginx.list /etc/apt/sources.list.d<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a warning about un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
If you did the package installation in the preceding section, you won't need to do this again. Just remove /etc/apt/sources.list.d/nginx.list to clean up, then <code>sudo apt-get update</code>.<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146528RPi Nginx Webserver2012-07-04T22:01:42Z<p>Rickb: /* Installing Nginx Using the Debian Package */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
cd<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo mv nginx.list /etc/apt/sources.list.d<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a warning about un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146522RPi Nginx Webserver2012-07-04T21:59:59Z<p>Rickb: /* Installing Nginx Using the Debian Package */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
cd<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo mv nginx.list /etc/apt/sources.list.d<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a problem with un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146516RPi Nginx Webserver2012-07-04T21:58:58Z<p>Rickb: /* Installing Nginx Using the Debian Package */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
sudo -s<br />
cd /etc/apt/sources.list.d<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
apt-get update<br />
apt-get install nginx<br />
<br />
This raises a problem with un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146510RPi Nginx Webserver2012-07-04T21:58:25Z<p>Rickb: /* Installing the Debian Package */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing Nginx Using the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
sudo -s<br />
cd /etc/apt/sources.list.d<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a problem with un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146504RPi Nginx Webserver2012-07-04T21:58:05Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
sudo -s<br />
cd /etc/apt/sources.list.d<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a problem with un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation from Source Code ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146498RPi Nginx Webserver2012-07-04T21:57:43Z<p>Rickb: /* Installing the Debian Package */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So the following will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
sudo -s<br />
cd /etc/apt/sources.list.d<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a problem with un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146492RPi Nginx Webserver2012-07-04T21:56:56Z<p>Rickb: /* Why Nginx? */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
== Installing the Debian Package ==<br />
<br />
The default Debian package is the wrong one - it's v0.7, way behind the latest stable release. So this will enable the latest (currently v1.2.2) version to be fetched instead:<br />
<br />
sudo -s<br />
cd /etc/apt/sources.d<br />
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >nginx.list<br />
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> nginx.list<br />
sudo apt-get update<br />
sudo apt-get install nginx<br />
<br />
This raises a problem with un-authenticated packages - you can either accept this warning, or if you prefer install from the source code instead, as described next.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146474RPi Nginx Webserver2012-07-04T21:21:35Z<p>Rickb: /* Appendix 2: Uninstall */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146468RPi Nginx Webserver2012-07-04T21:16:45Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146462RPi Nginx Webserver2012-07-04T21:16:30Z<p>Rickb: /* Appendix 1: Install Script */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146456RPi Nginx Webserver2012-07-04T21:10:45Z<p>Rickb: /* Nginx with PHP */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
Configure Nginx and PHP to work together as [http://wiki.nginx.org/PHPFcgiExample described here].<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146450RPi Nginx Webserver2012-07-04T21:07:38Z<p>Rickb: /* Nginx with PHP */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146444RPi Nginx Webserver2012-07-04T21:05:13Z<p>Rickb: /* Nginx with PHP */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
This is another download of ten minutes or so.<br />
<br />
sudo apt-get install mysql-server php5-cgi php5-mysql<br />
<br />
''Note:'' During the install you will be asked for a password for accessing MySql with. This will be for root access so choose something you will not forget: you will need it again at some point!<br />
<br />
The apt-get program will have left the downloads on your server and these take up space. If you want to remove them (as its now all installed) you can run the following to remove all apt-get download files:<br />
<br />
sudo apt-get clean<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146438RPi Nginx Webserver2012-07-04T20:52:44Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can test it using<br />
<br />
curl -s http://localhost/<br />
<br />
or point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
* todo<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146426RPi Nginx Webserver2012-07-04T20:43:53Z<p>Rickb: /* Appendix 2: Uninstall */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
* todo<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
# Our compiled-from-source files:<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
# Your static content:<br />
sudo rm -rf /var/www<br />
# The Debian scripts that came with the apt-get version:<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146420RPi Nginx Webserver2012-07-04T20:43:19Z<p>Rickb: /* Appendix 2: Uninstall */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
* todo<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
'''Beware!''' This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
Your static content:<br />
<br />
sudo rm -rf /var/www<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146414RPi Nginx Webserver2012-07-04T20:42:00Z<p>Rickb: /* Appendix 2: Uninstall */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
* todo<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146408RPi Nginx Webserver2012-07-04T20:39:40Z<p>Rickb: /* Nginx with PHP */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
* todo<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /usr/sbin/nginx* /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146402RPi Nginx Webserver2012-07-04T20:39:17Z<p>Rickb: /* Using Nginx for Static Content */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, always give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /usr/sbin/nginx* /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146396RPi Nginx Webserver2012-07-04T20:38:20Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful startup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /usr/sbin/nginx* /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146390RPi Nginx Webserver2012-07-04T20:37:45Z<p>Rickb: </p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful starup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get clean<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /usr/sbin/nginx* /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146384RPi Nginx Webserver2012-07-04T20:34:52Z<p>Rickb: /* Appendix 1: Install Script */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful starup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo rm -rf /etc/nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /usr/sbin/nginx* /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146378RPi Nginx Webserver2012-07-04T20:34:35Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful starup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo rm -rf /etc/nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /usr/sbin/nginx* /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146372RPi Nginx Webserver2012-07-04T20:34:12Z<p>Rickb: /* Appendix 2: Uninstall */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful starup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
<br />
Our compiled-from-source files:<br />
<br />
sudo rm -rf /etc/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx<br />
<br />
The Debian scripts that came with the apt-get version:<br />
<br />
sudo rm -rf /etc/init.d/nginx /usr/sbin/nginx* /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146366RPi Nginx Webserver2012-07-04T20:30:35Z<p>Rickb: </p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful starup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
sudo rm -rf /etc/nginx /etc/init.d/nginx /usr/sbin/nginx* /usr/local/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx /var/run/nginx.pid /var/log/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146360RPi Nginx Webserver2012-07-04T20:30:04Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly we'll install the obsolete packaged version because it creates some useful starup scripts for us, then we'll remove it again.<br />
<br />
sudo apt-get -y install nginx<br />
sudo apt-get -y remove nginx<br />
<br />
Now grab the necessary Debian compilation utils and libraries.<br />
<br />
sudo apt-get -y install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
sudo rm -rf /etc/nginx /etc/init.d/nginx /usr/sbin/nginx* /usr/local/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx /var/run/nginx.pid /var/log/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146354RPi Nginx Webserver2012-07-04T20:27:55Z<p>Rickb: /* Appendix 2: Uniinstall */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uninstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
sudo rm -rf /etc/nginx /etc/init.d/nginx /usr/sbin/nginx* /usr/local/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx /var/run/nginx.pid /var/log/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146348RPi Nginx Webserver2012-07-04T20:27:37Z<p>Rickb: /* Appendix: Install Script */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix 1: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start<br />
<br />
== Appendix 2: Uniinstall ==<br />
<br />
Beware! This will brutally delete Nginx, all the configuration files and all the static content.<br />
<br />
sudo service nginx stop<br />
sudo rm -rf /etc/nginx /etc/init.d/nginx /usr/sbin/nginx* /usr/local/nginx /etc/logrotate.d/nginx /var/lib/update-rc.d/nginx /var/run/nginx.pid /var/log/nginx</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146342RPi Nginx Webserver2012-07-04T20:20:13Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It took about ten minutes on my Pi.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start</div>Rickbhttps://elinux.org/index.php?title=IPv6_-_Internet_Protocol_version_6&diff=146330IPv6 - Internet Protocol version 62012-07-04T19:53:48Z<p>Rickb: /* Introduction */</p>
<hr />
<div>== Introduction ==<br />
IPv6 is the next generation of the Internet Protocol, the protocol that makes the entire Internet work. The main advantage of IPv6 over the original Internet Protocol (IPv4) is that there are over 2^128 IPv6 addresses (compared to only 2^32 IP addresses). There are other advantages too, such as easier multicast.<br />
<br />
== Why IPv6? ==<br />
<br />
The Internet has grown rapidly in popularity since the original ARPAnet. As of early 2011, the final IPv4 blocks have been allocated by IANA to the regional Internet registries (RIRs). APNIC, the registry responsible for Asia's IP assignments, expects to run out of IPv4 addresses by the middle of the year. Without a plan for future growth, Internet connected devices may find themselves being placed behind a NAT in order to continue functioning.<br />
<br />
== Linux support for IPv6 ==<br />
<br />
Linux 2.6 has excellent support for IPv6, both at the user level and at the kernel level. If the network administrator has radvd installed on the network, embedded Linux devices can automatically determine their IPv6 addresses and routing tables without the need to additional configuration. <br />
<br />
== Setting up an IPv6 network at home ==<br />
<br />
[http://www.tunnelbroker.net/ he.net], as well as others, have a tunnel broker service that will allow you to route IPv6 over your existing IPv4 Internet connection. Apple's AirPort Extreme, as well as custom versions of the WRT firmware, will allow you to set up radvd and IPv6 tunneling on your home router through the Web interface. he.net also provides commands that you can copy and paste into your terminal to configure IPv6 access on your local machine, once the tunnel has been set up.<br />
<br />
[[Category:Networking]]</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146324RPi Nginx Webserver2012-07-04T19:52:31Z<p>Rickb: /* Using Nginx for Static Content */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, give the server a poke using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146318RPi Nginx Webserver2012-07-04T19:51:53Z<p>Rickb: /* Using Nginx for Static Content */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here]. After editing the config files, restart the server using<br />
<br />
sudo service nginx reload<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146312RPi Nginx Webserver2012-07-04T19:50:51Z<p>Rickb: /* Appendix: Install Script */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here].<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146306RPi Nginx Webserver2012-07-04T19:50:37Z<p>Rickb: /* Appendix: Install Script */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here].<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
sudo service nginx start</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146300RPi Nginx Webserver2012-07-04T19:49:11Z<p>Rickb: /* Nginx with PHP */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here].<br />
<br />
== Nginx with PHP ==<br />
<br />
== Appendix: Install Script ==<br />
<br />
For convenience, here are all the installation steps in one bunch you can copy and paste.</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146294RPi Nginx Webserver2012-07-04T19:48:06Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files, which is unusual and might actually make it slower, so you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here].<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146288RPi Nginx Webserver2012-07-04T19:45:09Z<p>Rickb: /* Using Nginx for Static Content */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files - this might make it faster or slower and you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go.<br />
<br />
You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here].<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146282RPi Nginx Webserver2012-07-04T19:44:42Z<p>Rickb: /* Using Nginx for Static Content */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files - this might make it faster or slower and you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
The 'standard' place for your website content is in /var/www. This is the default place that was set up for you by the steps given above. If you want to serve static web content only (no PHP or whatever) then you're good to go. You might like to go further and create virtual hosts or whatever - the configuration files you will need to edit are in /etc/nginx and how to write them is [http://wiki.nginx.org/Configuration described here].<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146276RPi Nginx Webserver2012-07-04T19:38:20Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files - this might make it faster or slower and you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
sudo mkdir -p /var/www<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146270RPi Nginx Webserver2012-07-04T19:37:18Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module' if you don't want to support https encryption;<br />
* adding '--without-http_gzip_module' if you prefer to serve uncompressed text files - this might make it faster or slower and you'd have to experiment.<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146264RPi Nginx Webserver2012-07-04T19:34:41Z<p>Rickb: /* Nginx Installation */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module'<br />
* adding '--without-http_gzip_module'<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146258RPi Nginx Webserver2012-07-04T19:33:45Z<p>Rickb: /* Why Nginx? */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you ''could'' install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
But there is a small hitch with installing Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module'<br />
* adding '--without-http_gzip_module'<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146252RPi Nginx Webserver2012-07-04T19:33:01Z<p>Rickb: /* Why Nginx? */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you could install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is '''[http://nginx.com/ Nginx]''' ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
There is a hitch with Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module'<br />
* adding '--without-http_gzip_module'<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_webserver&diff=146246RPi webserver2012-07-04T19:31:44Z<p>Rickb: /* See Also */</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
The board may not look that powerful but there is more than enough grunt to run a small web server supported by php and mysql. I have not covered this here but have also installed wordpress on the server and runs very well too.<br />
<br />
This HOWTO is based on the Debian build and has been tested on the first and second release.<br />
<br />
Please note you are required to check security setting and access to the server, this is a guide on getting to the first point of having a working server and first few pages.<br />
<br />
== Install Process ==<br />
=== Installing Lighttpd ===<br />
Lighttpd is one of the smallest web server around and ideal for the raspberry Pi as its uses very little memory.<br />
<br />
First you need to set up a group and user that the web server can use:<br><br />
<code><br />
sudo addgroup --system www-data<br><br />
sudo adduser www-data www-data<br />
</code><br><br />
Next run the install, this will take a few moments:<br><br />
<code><br />
sudo apt-get install lighttpd<br />
</code><br><br />
You can check that the server is installed correctly by typing:<br><br />
<code>ps -u www-data u</code><br><br />
<br />
The main web server is now installed and can be checked by opening a browser and entering the address of your server and checking Lighttpd's default information page:<br><br />
<code>http://[your raspberry pi address]/index.lighttpd.html</code><br />
<br />
NOTE: Your web sites files are located at /var/www/<br />
<br />
However you will also need php and mysql to get the best out of a web site...<br />
<br />
=== Installing php5 and mySQL ===<br />
This is much bigger than the web server alone so is going to take some time to download and install... for me it was around 10 mins.<br />
<br />
These can both be installed in one go by running the following:<br><br />
<code>sudo apt-get install mysql-server php5-cgi php5-mysql</code><br><br />
<br />
NOTE: During the install you will be asked for a password for accessing mySQL with. As this will be for root access I suggest something you will not forget! You will need it again at some point!<br />
<br />
The apt-get program will have left the downloads on your server and these take up space. If you want to remove them (as its now all installed) you can run the following to remove all apt-get download files:<br><br />
<code>sudo apt-get clean</code><br />
<br />
== Configuration and Setting Up ==<br />
=== Configuration of Lighttpd ===<br />
To access the PHP server, your web server needs to know where its installed. I'll also add a Error 404 handler as there is nothing worse than a visitor getting a Error 404 from your site!<br />
<br />
To turn on the cgi mod of the server type the following:<br><br />
<code>sudo lighty-enable-mod cgi</code><br><br />
<br />
I think this did more than create a configuration file but found I had to remove the mod and add the php setting directly in the Lighttpd configuration file as follows:-<br />
<br />
First remove the cgi reference in the cgi config file by adding a '#' to the start of the line. Edit the file as follows:<br><br />
<code>sudo pico /etc/lighttpd/conf-enabled/10-cgi-php.conf</code><br><br />
<br />
change line to read as follows:<br><br />
<code>#server.modules +=("mod_cgi")</code><br><br />
<br />
To 'SAVE' changes press Ctrl-O and [enter] followed by Ctrl-X and [enter].<br />
<br />
Now edit the main configuration files as follows:<br><br />
<code>sudo pico /etc/lighttpd/lighttpd.conf</code><br><br />
<br />
Add the following line to the server modules section:<br><br />
<code>"mod_cgi",</code><br><br />
<br />
Add the following to the end of the file:<br><br />
<code>cgi.assign = (".php" => "/usr/bin/php5-cgi")<br><br />
server.error-handler-404 = "/index.html"<br />
</code><br><br />
To 'SAVE' changes press Ctrl-O and [enter] followed by Ctrl-X and [enter].<br />
<br />
The first line added enables the cgi module, the second points to the php-cgi server if a .php file is accesses and the last is our Error 404 handler.<br />
<br />
You can set the file names to any page you want, I just set it to index.html as a default.<br />
<br />
Last thing to do in the configuration is to restart the server as follows:<br><br />
<code>sudo /etc/init.d/lighttpd force-reload</code><br><br />
<br />
=== Setting Up and Test ===<br />
I would suggest you may want to check the php service is working ok by creating a quick .php file:<br><br />
<code>sudo pico /var/www/phpinfo.php</code><br><br />
<br />
And add the following lines:<br><br />
<code><br />
<?php<br><br />
phpinfo();<br><br />
?><br />
</code><br><br />
<br />
Now as before use a browser to open your raspberry pi and access phpinfo.php<br><br />
<code>http://[your raspberry pi address]/phpinfo.php</code><br><br />
<br />
== References ==<br />
http://www.lowendbox.com/blog/yes-you-can-run-18-static-sites-on-a-64mb-link-1-vps/ > This HOTO is taken from here and tweaked and made a little clearer for Raspberry Pi owners.<br />
<br />
http://www.w3schools.com/ > Learn HTML, php and mySQL free on one of the best reference sites.<br />
<br />
== See Also ==<br />
* [[RPi Nginx Webserver]] - an alternative webserver on the Raspberry Pi</div>Rickbhttps://elinux.org/index.php?title=RPi_Nginx_Webserver&diff=146234RPi Nginx Webserver2012-07-04T19:31:19Z<p>Rickb: moved RPi nginx to RPi Nginx Webserver: Better summarises the content</p>
<hr />
<div>[[Category:RaspberryPi]]<br />
== Introduction ==<br />
<br />
Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by PHP and mysql.<br />
<br />
This HOWTO is based on the Debian build.<br />
<br />
== Why Nginx? ==<br />
<br />
By far the most of the world's websites are hosted on [http://httpd.apache.org/ Apache]. If your Pi runs Debian, you could install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.<br />
<br />
However, there are several good light-weight alternatives: [[RPi webserver]] covers installing [http://www.lighttpd.net/ Lighttpd], but a far more widely-used server is [http://nginx.com/ Nginx] ([http://nginx.org/ additional resources]). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.<br />
<br />
There is a hitch with Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.<br />
<br />
== Nginx Installation ==<br />
<br />
From your Pi's terminal, firstly grab the necessary Debian utils and libraries.<br />
<br />
sudo apt-get install build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev<br />
<br />
Now get the latest Nginx source code. This was v1.2.2 at the time of writing, but there will be [http://nginx.org/en/download.html more versions] along later.<br />
<br />
VERSION=1.2.2<br />
curl http://nginx.org/download/nginx-$VERSION.tar.gz | tar zxvf -<br />
<br />
Here's the bit where we build it using the traditional "./configure && make" procedure. It takes a few minutes.<br />
<br />
cd nginx-$VERSION<br />
./configure --sbin-path=/usr/sbin/nginx \<br />
--conf-path=/etc/nginx/nginx.conf \<br />
--pid-path=/var/run/nginx.pid \<br />
--error-log-path=/var/log/nginx/error.log \<br />
--http-log-path=/var/log/nginx/access.log \<br />
--with-http_ssl_module \<br />
--without-http_proxy_module<br />
make<br />
<br />
Note that those end of line back-slashes are necessary and mustn't be followed by any space characters. The first five options make Nginx play nicely with Debian. The other two options give you a typical build, including encryption (ssl) support but not proxying. The complete set of options for ./configure are [http://nginx.org/en/docs/install.html here]. You could save some Pi resources by <br />
<br />
* missing off '--with-http_ssl_module'<br />
* adding '--without-http_gzip_module'<br />
<br />
Now it's built, you have to be root to install your shiny new webserver, like this:<br />
<br />
sudo make install<br />
<br />
and you'll need some sample content perhaps:<br />
<br />
sudo mkdir -p /var/www<br />
sudo cp html/* /var/www<br />
<br />
Finally, start the server:<br />
<br />
sudo service nginx start<br />
<br />
If this succeeds, everything went according to plan. You can point your web browser at your Pi (http://mypi.local/ or http://192.168.1.10/ or whatever its name is).<br />
<br />
== Using Nginx for Static Content ==<br />
<br />
== Nginx with PHP ==</div>Rickbhttps://elinux.org/index.php?title=RPi_nginx&diff=146240RPi nginx2012-07-04T19:31:19Z<p>Rickb: moved RPi nginx to RPi Nginx Webserver: Better summarises the content</p>
<hr />
<div>#REDIRECT [[RPi Nginx Webserver]]</div>Rickb