To Install Nginx, setup the prerequisites as following.
yum install GCC #C compiler yum install pcre* # perl regular expression yum install zlib zlib-devel yum install openssl openssl-devel |
Download Nginx From http://nginx.org/en/download.html, and extract to a source folder, I will use /tmp here
wget http://nginx.org/download/nginx-0.8.54.tar.gz tar -zxvf nginx-0.8.54.tar.gz cd /tmp/nginx-0.8.54 ./configure --prefix=/opt/nginx make && make install |
once done, you can run ./nginx –? to show all available options ,
for the default loading, it read the conf file which is conf/nginx.conf
to start the nginx, just run ./nginx, you will get the helloworld page.
here, I changed ngingx.conf a little with a New port 88, and basic proxy forward to Apache,PHP (check installation instructions, Install PHP to Apache web server)
server { #charset koi8-r; #access_log logs/host.access.log main; location / { #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # proxy the PHP scripts to Apache listening on 127.0.0.1:80 |
if I access http://localhost:88/info.php, nginx will forward the request to http://localhost/info.php
But the server header is nginx Now. Also the ngnix has enabled the GZIP support now. ( a great reverse proxy, offloading those cut-off features)
more how-tos:
No comments:
Post a Comment