Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

nginx Setup Problems

R_JR_J Ex-FanboyMunich Admin

I've tried to setup a USB stick with nginx with Vanilla 2.0.18.10 and 2.1b2. They should listen to localhost:8020 and localhost:8021. I found several descriptions and tipps on how to set up nginx with Vanilla and I have V2.0 up and running.
Copying the server entries in ngninx.conf for V2.1 doesn't work.

  1. I get no error log :(
  2. my access log shows "GET / HTTP/1.1" 302 31 (too many redirects?)
  3. it creates /cache/c_library_map.ini

Content of the cache file is a little short...

[cache]
gdn = "E:\www\vanilla21b2/library/core/class.gdn.php"
gdn_factory = "E:\www\vanilla21b2/library/core/class.factory.php"
gdn_configuration = "E:\www\vanilla21b2/library/core/class.configuration.php"
gdn_pluggable = "E:\www\vanilla21b2/library/core/class.pluggable.php"
gdn_sliceprovider = "E:\www\vanilla21b2/library/core/class.sliceprovider.php"
gdn_request = "E:\www\vanilla21b2/library/core/class.request.php"
gdn_applicationmanager = "E:\www\vanilla21b2/library/core/class.applicationmanager.php"
gdn_pluginmanager = "E:\www\vanilla21b2/library/core/class.pluginmanager.php"
gdn_cache = "E:\www\vanilla21b2/library/core/class.cache.php"
gdn_format = "E:\www\vanilla21b2/library/core/class.format.php"
gdn_dirtycache = "E:\www\vanilla21b2/library/core/class.dirtycache.php"
gdn_url = "E:\www\vanilla21b2/library/core/class.url.php"

My nginx.conf is

 #user  nobody;
 worker_processes  1;

 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
 #error_log  logs/error.log  info;

 #pid        logs/nginx.pid;


 events {
     worker_connections  1024;
 }


 http {
     include       mime.types;
     default_type  application/octet-stream;

     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
     #                  '$status $body_bytes_sent "$http_referer" '
     #                  '"$http_user_agent" "$http_x_forwarded_for"';

     #access_log  logs/access.log  main;

     sendfile        on;
     #tcp_nopush     on;

     #keepalive_timeout  0;
     keepalive_timeout  65;

   gzip  on;

   #Vanilla 2.0.18.10
   server {
      listen       8020;
      server_name  localhost;
      allow  127.0.0.1;
      deny   all;
      charset utf-8;
      autoindex off;

      access_log /Server/nmp-server-2.1/nginx-1.2.5/logs/vanilla20.access.log;
      error_log /Server/nmp-server-2.1/nginx-1.2.5/logs/vanilla20.error.log;

      ## Default location
      location / {
         root   /www/vanilla201810;
         index  index.php index.html index.htm;
         try_files $uri @site;
      }
      location @site {
        rewrite ^ /index.php?p=$uri&$args last;
      }

      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
      location ~ \.php$ {
         root           /www/vanilla201810;
         fastcgi_pass         127.0.0.1:9000;
         fastcgi_index        index.php;
         fastcgi_param        SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include              fastcgi_params;
         fastcgi_read_timeout 300;
      }

      # Stop things from executing in the uploads directory
      location ~* ^/uploads/.*.(html|htm|shtml|php)$ {
         types { }
         default_type text/plain;
      }

      # Deny, drop, or internal locations
      location ~ /\. { access_log off; log_not_found off; deny all; }
      location ~ ~$ { access_log off; log_not_found off; deny all; }
      location = /robots.txt { access_log off; log_not_found off; }
      location ^~ favicon { access_log off; log_not_found off; }
      location ^~ /conf/ { internal; }

      location = /favicon.ico {
        return 204;
        access_log     off;
        log_not_found  off;
      }

      # Taking advantage of browser caching for static stuff
      location ~* \.(js|css|png|jpg|jpeg|gif|ico|eot|woff|ttf|svg)$ {
         root   /www/vanilla201810;
         expires max;
         log_not_found off;
      }
   }

   #Vanilla 2.1b2
   server {
      listen       8021;
      server_name  localhost;
      allow  127.0.0.1;
      deny   all;
      charset utf-8;
      autoindex off;

      access_log /Server/nmp-server-2.1/nginx-1.2.5/logs/vanilla21.access.log;
      error_log /Server/nmp-server-2.1/nginx-1.2.5/logs/vanilla21.error.log;

      ## Default location
      location / {
         root   /www/vanilla21b2;
         index  index.php index.html index.htm;
#         try_files $uri @site;
      }
#      location @site {
#        rewrite ^ /index.php?p=$uri&$args last;
#      }

      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
      location ~ \.php$ {
         root           /www/vanilla21b2;
         fastcgi_pass         127.0.0.1:9000;
         fastcgi_index        index.php;
         fastcgi_param        SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include              fastcgi_params;
         fastcgi_read_timeout 300;
      }

      # Stop things from executing in the uploads directory
      location ~* ^/uploads/.*.(html|htm|shtml|php)$ {
         types { }
         default_type text/plain;
      }

      # Deny, drop, or internal locations
      location ~ /\. { access_log off; log_not_found off; deny all; }
      location ~ ~$ { access_log off; log_not_found off; deny all; }
      location = /robots.txt { access_log off; log_not_found off; }
      location ^~ favicon { access_log off; log_not_found off; }
      location ^~ /conf/ { internal; }

      location = /favicon.ico {
        return 204;
        access_log     off;
        log_not_found  off;
      }

      # Taking advantage of browser caching for static stuff
      location ~* \.(js|css|png|jpg|jpeg|gif|ico|eot|woff|ttf|svg)$ {
         root   /www/vanilla21b2;
         expires max;
         log_not_found off;
      }
   }
}

I've already tried a lot of things but always end up with the same access log entry. Can anybody point me in the right direction, please?

Answers

  • R_JR_J Ex-Fanboy Munich Admin

    It's a port problem! I've managed to set it up using localhost/vanilla21b2(:80) when setting up a server that has its root at /www and my files are in /www/vanilla21b2
    Afterwards I could see it using localhost:8021 but I couldn't login.
    Now I've set my server to /www/vanilla21b2:80 and everything runs smooth.
    If I set it to /www/vanilla21b2:8021 I can't login...

    hgtonight
  • R_JR_J Ex-Fanboy Munich Admin

    Forget about it.

    I do not use that strange port way but instead I will use the directory. No need for creating two separate servers, I think.

Sign In or Register to comment.