Install/Nginx: Difference between revisions

From Playful Exploration
Jump to navigation Jump to search
(Created page with "...")
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
...
[[category:Install]]
 
==background==
look that the following URLs in order to grasp a solid understanding of the nginx configuration files in order to fully unleash the power of Nginx
 
*[http://wiki.nginx.org/Pitfalls Pitfalls]
*[http://wiki.nginx.org/QuickConfigure QuickConfigure ]
*[http://wiki.nginx.org/Configuration Configuration]
 
==Steps==
Using ssh:
 
    apt-get install nginx-full
    service nginx start
    nano /etc/nginx/sites-available/default
 
look for:
 
    [...]
    server {
        listen  80;
 
configure the server name to server name or ip
 
    server_name www.playfulexploration.com;
 
if you are planning using php file hosting then add index.php to index
 
    index index.php index.html index.htm;
 
change the "location ~ \.php$ {" section, uncomment the php related stuff include snippets/fastcgi-php.conf
 
    location ~ \.php$ {
      try_files $uri =404;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
 
to route a sub-domain call to a local service or docker image use this:
server {
        server_name b.chaospage.com;
        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass http://172.17.0.3;    # use http://TARGETIP:PORT if needed
        }
}

Latest revision as of 05:16, 4 July 2016


background

look that the following URLs in order to grasp a solid understanding of the nginx configuration files in order to fully unleash the power of Nginx

Steps

Using ssh:

   apt-get install nginx-full
   service nginx start
   nano /etc/nginx/sites-available/default

look for:

   [...]
   server {
       listen   80;

configure the server name to server name or ip

   server_name www.playfulexploration.com;

if you are planning using php file hosting then add index.php to index

   index index.php index.html index.htm;

change the "location ~ \.php$ {" section, uncomment the php related stuff include snippets/fastcgi-php.conf

   location ~ \.php$ {
     try_files $uri =404;
     fastcgi_pass unix:/var/run/php5-fpm.sock;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;

to route a sub-domain call to a local service or docker image use this:

server {
        server_name b.chaospage.com;
        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass http://172.17.0.3;    # use http://TARGETIP:PORT if needed
        }
}