Solving WordPress not loaded properly in NGINX


I have built a few wordpress sites on HAProxy and NGINX. Somehow, my clients tell me that wp-admin doesn’t loaded properly. When start new post or editing, text menu doesn’t load properly. Also, when show button clicked on image manager, it will get nothing.

So, i try to check and got this by firebug :

1
Jquery is not defined

So, i open nginx conf, this is the past version :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
….
    index  index.php index.html index.htm;

    # catch all
    error_page 404 /index.php;
    location = /favicon.ico {  
        log_not_found off;
        access_log off;
    }
 
    location = /robots.txt {
        allow all;
        log_not_found off;  
        access_log off;
    }
   
    location / {
        # This is cool because no php is touched for static content
….

Then i change into this one :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

    index  index.php;
   
    location / {
        # This is cool because no php is touched for static content
        try_files $uri $uri/ /index.php;
    }

    # catch all
    error_page 404 /index.php;
    location = /favicon.ico {  
        log_not_found off;
        access_log off;
    }
 
    location = /robots.txt {
        allow all;
        log_not_found off;  
        access_log off;
    }

And all issue are solved!
It’s pretty weird, but changes NGINX conf solve this problem.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.