Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

nginx wordpress js with gzip?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Locked
  • Print view
Advanced search
21 posts
  • Previous
  • 1
  • 2
  • 3
  • Next
hcjsy
Posts: 16
Joined: Tue Jun 07, 2016 3:56 pm

Re: nginx wordpress js with gzip?

Post by hcjsy » Wed Jun 08, 2016 12:14 pm

SS88 wrote:If you add it directly in server { }

/home/<USER>/conf/web/nginx.conf like so:

Code: Select all

server {

listen      blah;
server_name blah;
root        /home/blah/web/blah/public_html

gzip on;
gzip_disable "msie6";

gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/js text/javascript application/javascript application/x-javascript;
}
Does that work!?
no didnt work either, and made sure I restarted the nginx service.
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx wordpress js with gzip?

Post by SS88 » Wed Jun 08, 2016 12:18 pm

hcjsy wrote:nginx: [warn] duplicate extension "js", content type: "application/x-javascript", previous content type: "application/javascript" in /etc/nginx/mime.types:9
nginx: [warn] duplicate extension "js", content type: "application/x-javascript", previous content type: "application/javascript" in /etc/nginx/mime.types:9
mime.types should be added like so (example only):

Code: Select all

    image/jpeg                            jpeg jpg;
    application/javascript text/javascript application/x-javascript                js;
    application/atom+xml                  atom;
    application/rss+xml                   rss;
What is your OS? Windows?
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx wordpress js with gzip?

Post by SS88 » Wed Jun 08, 2016 12:21 pm

One guy here? Maybe this would help?

http://stackoverflow.com/a/24529623/2669945
Top

hcjsy
Posts: 16
Joined: Tue Jun 07, 2016 3:56 pm

Re: nginx wordpress js with gzip?

Post by hcjsy » Wed Jun 08, 2016 12:38 pm

have adjusted the mime.types so that duplicate message is gone, and added the

Code: Select all

gzip_http_version   1.0;
thanks for finding that, but didnt work :(

the server is ubuntu 14
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx wordpress js with gzip?

Post by SS88 » Wed Jun 08, 2016 12:47 pm

Code: Select all

root@pool:~# curl -H "Accept-Encoding: gzip" -I http://wordpress.highlands.ac.uk/wp-includes/js/wp-embed.min.js
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 1403
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Date: Wed, 08 Jun 2016 12:47:12 GMT
Content-Type: application/javascript
ETag: "57569748-57b"
Server: nginx
Accept-Ranges: bytes
Last-Modified: Tue, 07 Jun 2016 09:43:36 GMT
Vary: Accept-Encoding
Cache-Control: max-age=315360000
Not sending the header. I don't think I can help any further!
Top

hcjsy
Posts: 16
Joined: Tue Jun 07, 2016 3:56 pm

Re: nginx wordpress js with gzip?

Post by hcjsy » Wed Jun 08, 2016 12:52 pm

What do you mean by not sending the header?

I ran the command here and :

Code: Select all

root@oo:~# curl -H "Accept-Encoding: gzip" -I http://wordpress.highlands.ac.uk/wp-includes/js/wp-embed.min.js
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 08 Jun 2016 12:50:48 GMT
Content-Type: application/javascript
Last-Modified: Tue, 07 Jun 2016 09:43:36 GMT
Connection: keep-alive
Keep-Alive: timeout=60
Vary: Accept-Encoding
ETag: W/"57569748-57b"
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Content-Encoding: gzip
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx wordpress js with gzip?

Post by SS88 » Wed Jun 08, 2016 1:04 pm

I tried again on a different server:

Code: Select all

[root@atl ~]# curl -H "Accept-Encoding: gzip" -I http://wordpress.highlands.ac.uk/wp-includes/js/wp-embed.min.js
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 1403
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Date: Wed, 08 Jun 2016 13:03:32 GMT
Content-Type: application/javascript
ETag: "57569748-57b"
Server: nginx
Accept-Ranges: bytes
Last-Modified: Tue, 07 Jun 2016 09:43:36 GMT
Vary: Accept-Encoding
Cache-Control: max-age=315360000
and with --compressed

Code: Select all

[root@atl ~]# curl -H "Accept-Encoding: gzip" --compressed -I http://wordpress.highlands.ac.uk/wp-includes/js/wp-embed.min.js
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 1403
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Date: Wed, 08 Jun 2016 13:04:04 GMT
Content-Type: application/javascript
ETag: "57569748-57b"
Server: nginx
Accept-Ranges: bytes
Last-Modified: Tue, 07 Jun 2016 09:43:36 GMT
Vary: Accept-Encoding
Cache-Control: max-age=315360000
Top

hcjsy
Posts: 16
Joined: Tue Jun 07, 2016 3:56 pm

Re: nginx wordpress js with gzip?

Post by hcjsy » Wed Jun 08, 2016 1:14 pm

strange, I just edited the config changed gzip to off, ran the curl on my machine again and came back as expected

Code: Select all

curl -H "Accept-Encoding: gzip" -I http://wordpress.highlands.ac.uk/wp-includes/js/wp-embed.min.js
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 08 Jun 2016 13:10:48 GMT
Content-Type: application/javascript
Content-Length: 1403
Last-Modified: Tue, 07 Jun 2016 09:43:36 GMT
Connection: keep-alive
Keep-Alive: timeout=60
ETag: "57569748-57b"
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Accept-Ranges: bytes
changed it back to on, and as expected at the bottom when running the command again:

Code: Select all

Content-Encoding: gzip
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx wordpress js with gzip?

Post by SS88 » Wed Jun 08, 2016 1:34 pm

When I view it with Google Chrome css and js files are not sending the header either.
Request URL:http://wordpress.highlands.ac.uk/wp-con ... styles.css


HTTP/1.1 304 Not Modified
Connection: Keep-Alive
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Date: Wed, 08 Jun 2016 13:32:39 GMT
ETag: "575696ed-69b"
Server: nginx
Last-Modified: Tue, 07 Jun 2016 09:42:05 GMT
Cache-Control: max-age=315360000
Top

hcjsy
Posts: 16
Joined: Tue Jun 07, 2016 3:56 pm

Re: nginx wordpress js with gzip?

Post by hcjsy » Thu Jun 09, 2016 7:37 am

I managed to resolve this. It was to do with the firewall (tmg 2010) not passing on from the client to the webserver that the client is gzip ready.
Top


Locked
  • Print view

21 posts
  • Previous
  • 1
  • 2
  • 3
  • Next

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password