0

I'm trying to make Nginx proxy multiple web applications (among others, Tiny Tiny RSS and phpPgAdmin) onto different subdirectories under the same domain.

For example, TT RSS is under /home/ttrss/www/, served by a PHP5 FPM process running under user "ttrss", and other webapps follow the same model.

Here is the relevant Nginx configuration :

# Tiny Tiny RSS
location /ttrss/ {
  alias /home/ttrss/www/;
  index index.php;
}

location ~ /ttrss/.*\.php$ {
  if ($fastcgi_script_name ~ /ttrss(/.*\.php)$) {
    set $valid_fastcgi_script_name $1;
  }
  include fastcgi_params;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME /home/ttrss/www/$valid_fastcgi_script_name;
}

I have never used Nginx before, and I'd like to know if the way I did it is the "right way", or if there's a different, easier or simply better way I didn't know about.

3 Answers 3

0

I have never used Nginx before, and I'd like to know if the way I did it is the "right way",

there is a wide variety of beginners-documentation available @ wiki.nginx.org and i think your should read those guides first and come back if you have specific questions.

0

You should be able to solve this with nested locations. You are likely to have to fiddle with includes to avoid duplicating too much.

location /tt-rss/ {

    root /my/install/dir/for/ttrss; 
    index index.php;

    # block these
    location ~* (include/|lock/|utils/|locale/|classes/*) {
         deny all;
    }

    # PHP ttrss
    location ~ \.php$ {
     ...
     }

  }
-1

you must create at / etc / nginx / sites-enabled /

ttrss such a file to be your virtualhost

server {
     listen 80;
     server_name localhost;
     root /var/www/;
     server_tokens off;
     access_log /dev/null;
     error_log /var/log/nginx/ttrss.error.log;
     index index.php;

    location ~ \.php${
          {Your PHP Configuration}
     }
}
  • Save the file.

Then restart the nginx to take the changes

/etc/init.d/nginx restart

I hope this can help you

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .