Page 1 of 1

How to configure nginx server for OpenKM with virtual host

PostPosted:Mon Jul 07, 2014 3:26 am
by tiopourtu
Dear All,

I run the OpenKM with Nginx as a reverse proxy and it work just fine. But when I use the server to work with another application I face the problem with Nginx configuration. I'm not sure if it could be done or not. Here's the story:
  1. I install the OpenKM in /opt/openkm
  2. In Nginx sites-enabled I have : openkm with below configuration:
    Code: Select all
    server {
        server_name portal.webserver.com;
        rewrite ^/$ /OpenKM/ permanent;
    
        location /OpenKM/ {
             proxy_set_header X-Forwarded-Host $host;
             proxy_set_header X-Forwarded-Server $host;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_pass http://localhost:8080/OpenKM/;
        }
    }
  3. From that point I can access portal.webserver.com and then got redirected to portal.webserver.com/OpenKM/
  4. Then I add another webserver call it : portal with below configuration:
    Code: Select all
    server {
            listen 80;
            root /var/www/;
            index index.php index.html index.htm;
    
            server_name portal.webserver.com;
    
            location / {
                    try_files $uri $uri/ /index.php;
            }
            location ~ \.php$ {
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $remote_addr;
                    proxy_set_header Host $host;
                    proxy_pass http://127.0.0.1:81;
            }
            location ~ /\.ht {
                    deny all;
            }
    }
    
  5. What I want to achieve is when I type http://portal.webserver.com it will display the portal home which is served by Apache via port 81
  6. and when I type http://portal.webserver.com/OpenKM it will display portal.webserver.com/OpenKM which is served by tomcat via port 8080
  7. Unfortunately I got no luck because I think those configuration is totally wrong but I don't now how to achieve it.
I appreciate for any suggestion...

Thanks,
Tio

Re: How to configure nginx server for OpenKM with virtual ho

PostPosted:Wed Jul 09, 2014 7:18 am
by jllort
I suggest for this question go to http://forum.nginx.org/ because is so much specific question. Normally us we configure apache and we've not been involved in this type of configuration you suggested.

Re: How to configure nginx server for OpenKM with virtual ho

PostPosted:Wed Jul 09, 2014 6:41 pm
by tiopourtu
Dear jllort,

Thanks for u'r reply, I'll search into nginx's forum. If I got the way out I'll be back to update this post.

Regards,
Tio

Re: How to configure nginx server for OpenKM with virtual ho

PostPosted:Fri Jul 11, 2014 4:22 pm
by jllort
Thanks, if you found the solution you're welcome to share here, because it can be useful to other users.