• How to configure nginx server for OpenKM with virtual host

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #29182  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

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.