D
D
divays72014-01-27 01:40:28
Java
divays7, 2014-01-27 01:40:28

How to properly configure Nginx and Glassfish?

Hello!
I deployed its url -> localhost:8080/app on Glassfish war and configured Nginx as follows:

server {
    listen 80;
    server_name domain1.info www.domain1.info;

    rewrite ^/(.*)$ /app/$1;

    location / {
      proxy_pass http://localhost:8080;
      proxy_redirect off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location ~* \.(jpg|png|gif|jpeg|css|js|doc|pdf|xls|docx|xlsx|odt|odc|ico)$ {
        		root /home/servers/glassfish4/glassfish/domains/domain1/applications/app;
      add_header Cache-Control public;
                        expires 4w;
    		}

}

Everything seems to be working, I go to the domain1.info URL and the page is shown, but the css styles and images are not shown.
Who will tell you what is wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Vasilchuk, 2014-01-27
@Anonym

What does the browser write to the console?
What does Nginx write to the logs?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question