Nginx 1.6.0 and Pagespeed Build Not Working

1,561 views
Skip to first unread message

Wilfred Khalik

unread,
Apr 30, 2014, 6:06:04 PM4/30/14
to ngx-pagesp...@googlegroups.com
Okay I am going Kahoonas over this.I have followed everything in this link:  https://github.com/pagespeed/ngx_pagespeed/blob/b4af0738a5dcf217dc821ae900b8666f491400e0/README.md 

many times over and even compiling Pagespeed from source but I still can not for the life of me see nginx working.I enter my server's IP address on my web browser and absolutely nothing - no nginx message that nginx is working and I also tried /etc/init.d/nginx start  on the command line and keep getting messages that nginx was not found, etc….

Sorry, but I think my frustration is getting the better of me -  Is there something, a dependency, some secret sauce maybe that I am missing.


Thanks in advance.

Wilfred Khalik

unread,
Apr 30, 2014, 8:58:41 PM4/30/14
to ngx-pagesp...@googlegroups.com

Okay in addition to the above - I try to fire-up nginnx by typing the following command /usr/local/nginx/sbin/nginx but I get the following message:

The program 'nginx' can be found in the following packages:

  • nginx-extras
  • nginx-full
  • nginx-light
  • nginx-naxsi Try: apt-get install

What the hell is going on???

Jeff Kaufman

unread,
May 1, 2014, 10:46:24 AM5/1/14
to ngx-pagesp...@googlegroups.com
Could you paste the output you got when you ran "make install"? It
should have printed something about where it installed nginx to.
> --
> You received this message because you are subscribed to the Google Groups
> "ngx-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ngx-pagespeed-di...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ngx-pagespeed-discuss.
> For more options, visit https://groups.google.com/d/optout.

Wilfred Khalik

unread,
May 1, 2014, 10:31:28 PM5/1/14
to ngx-pagesp...@googlegroups.com

Hello Jeff,
Below is what appears after running the make install command:

  make -f objs/Makefile install
make[1]: Entering directory `/root/nginx-1.6.0'
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/nginx/sbin' || mkdir -p '/usr/local/nginx/sbin'
test ! -f '/usr/local/nginx/sbin/nginx' || mv '/usr/local/nginx/sbin/nginx' '/usr/local/nginx/sbin/nginx.old'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
test -d '/usr/local/nginx/conf' || mkdir -p '/usr/local/nginx/conf'
cp conf/koi-win '/usr/local/nginx/conf'
cp conf/koi-utf '/usr/local/nginx/conf'
cp conf/win-utf '/usr/local/nginx/conf'
test -f '/usr/local/nginx/conf/mime.types' || cp conf/mime.types '/usr/local/nginx/conf'
cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
test -f '/usr/local/nginx/conf/fastcgi_params' || cp conf/fastcgi_params '/usr/local/nginx/conf'
cp conf/fastcgi_params '/usr/local/nginx/conf/fastcgi_params.default'
test -f '/usr/local/nginx/conf/fastcgi.conf' || cp conf/fastcgi.conf '/usr/local/nginx/conf'
cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
test -f '/usr/local/nginx/conf/uwsgi_params' || cp conf/uwsgi_params '/usr/local/nginx/conf'
cp conf/uwsgi_params '/usr/local/nginx/conf/uwsgi_params.default'
test -f '/usr/local/nginx/conf/scgi_params' || cp conf/scgi_params '/usr/local/nginx/conf'
cp conf/scgi_params '/usr/local/nginx/conf/scgi_params.default'
test -f '/usr/local/nginx/conf/nginx.conf' || cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory `/root/nginx-1.6.0'



Hell I go into the /usr/local/nginx/sbin/nginx file and enter: 

nginx    as well  as  service nginx start     and   service nginx restart

and hit the enter button….Anything to fire this baby up but nothings happening.

I keep getting the following error:

The program 'nginx' can be found in the following packages:
 * nginx-extras
 * nginx-full
 * nginx-light
 * nginx-naxsi

OR

nginx: unrecognized service

Cheers.

Gawain Lynch

unread,
May 1, 2014, 10:40:34 PM5/1/14
to ngx-pagesp...@googlegroups.com
Um, what about just executing the compiled and installed binary rather than the system installed one with:

# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf




--

Gawain Lynch

unread,
May 1, 2014, 10:41:20 PM5/1/14
to ngx-pagesp...@googlegroups.com
Being that I think you're on Ubuntu you will probably need to `sudo` that command.

Wilfred Khalik

unread,
May 1, 2014, 11:16:13 PM5/1/14
to ngx-pagesp...@googlegroups.com
I'll give that a go and see how things go..Right now I'll give anything a go…lol


--
You received this message because you are subscribed to a topic in the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ngx-pagespeed-discuss/ewcG1P37gyM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ngx-pagespeed-di...@googlegroups.com.

Gawain Lynch

unread,
May 1, 2014, 11:18:29 PM5/1/14
to ngx-pagesp...@googlegroups.com
Also bear in mind that you need to configure the config files (/usr/local/nginx/conf/nginx.conf at the very least) to tell it about your host and also what ngx_pagespeed settings you want.

Wilfred Khalik

unread,
May 1, 2014, 11:24:15 PM5/1/14
to ngx-pagesp...@googlegroups.com
Got yah….Since I am a bit new to this compiling thingy, I'll give it my best shot - But I'll scream out if I really am stuck.

Status: Firing up a new VPS - gonna have a shower so I'll be a while.
Cheers.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ngx-pagespeed-discuss/ewcG1P37gyM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

Wilfred Khalik

unread,
May 1, 2014, 11:47:09 PM5/1/14
to ngx-pagesp...@googlegroups.com
Just FYI - I am running this as root…Its a test machine so I didnt want to bother with all the sudoing.

That should clear up any questions at the back of yer minds about permissions…at least a little bit.

Server Specs are : 512MB VPS @ Digital Ocean running on Ubuntu 12.04 LTS fully updated.

Cheers….more updates in a giffy…

Wilfred Khalik

unread,
May 2, 2014, 12:26:42 AM5/2/14
to ngx-pagesp...@googlegroups.com
Holy Smoke the Dog from Kingdom Come….

This one-liner absolutely nailed it: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

Hell yeah - after all the frustration this baby is actually is actually alive and kicking now.

Now I dont know what the hell that one line - but it sure does its thing well…lol

Kudos to yah Gawain…It worked…Well I can see the Welcome Nginx screen when I fire up my browser and point it to my VPS Public IP so Nginx is working…

Will continue working on Pagespeed Config and Nginx Config files.

P.S: What the hell does that one line do????

Cheers.

Gawain Lynch

unread,
May 2, 2014, 12:36:30 AM5/2/14
to ngx-pagesp...@googlegroups.com
Glad to have helped.  Just a little more info to help you get moving a bit faster in a self-empowered way...  :-)
  1. The build script — by default — installs everything into /usr/local/nginx/ 
  2. The '-c' switch tells the Nginx binary where to find the base configuration file (/usr/local/nginx/conf/nginx.conf).  I am not 100% sure if it is needed in a default install, but I was hoping to avoid you not getting it working quickly.  
​Below is a Nginx external .conf file that I use in my ​Nginx RPM packages that I build for CentOS 6.  I have added a lot of information from the Goggle documentation to help users understand and get going.

Also please note, I am just "someone", I don't work for Google or Nginx, so trust my advice as you would anything on the Internet :-D

​Take care,

Gawain

pagespeed on;
pagespeed RewriteLevel CoreFilters;

# Needs to exist and be writable by nginx
pagespeed FileCachePath /var/cache/nginx/ngx_pagespeed;

################################################################################
## Statistics logging                                                         ##
################################################################################
pagespeed Statistics on;
pagespeed StatisticsLogging on;
pagespeed LogDir /var/log/pagespeed;

################################################################################
## Optimize caching                                                           ##
################################################################################

# This filter identifies popular JavaScript libraries that can be replaced with 
# ones hosted for free by a JavaScript library hosting service — by default the 
# Google Hosted Libraries. 
#pagespeed EnableFilters canonicalize_javascript_libraries;

# Improve the cacheability of a web page's resources without compromising the 
# ability to change the resources and have those changes propagate to users' 
# browsers.
pagespeed EnableFilters extend_cache;

# 'Extend Cache PDFs' is a version of Extend Cache that acts on PDFs. Unlike 
# 'Extend Cache' it applies not only to resources but also to hyperlinks. 
#pagespeed EnableFilters extend_cache_pdfs;

# The 'Outline JavaScript' filter outlines all JavaScript that is larger than a 
# minimum threshold in bytes. 
#pagespeed EnableFilters outline_javascript;
#pagespeed JsOutlineMinBytes 3000;


################################################################################
## Minimize round-trip times                                                  ##
################################################################################

# 'Combine CSS' seeks to reduce the number of HTTP requests made by a browser 
# during page refresh by replacing multiple distinct CSS files with a single CSS
# file, containing the contents of all of them.
pagespeed EnableFilters combine_css;

# 'Move CSS Above Scripts' seeks to make sure scripts do not block the loading
# of CSS resources.
pagespeed EnableFilters move_css_above_scripts;

# Recursively processes imported CSS files; if a file cannot be processed then 
# the entire process is aborted and the initial CSS is left unflattened.
pagespeed EnableFilters flatten_css_imports;
#pagespeed CssFlattenMaxBytes bytes;

# When the 'Inline CSS' filter is enabled, The contents of small external CSS
# resources are written directly into the HTML document; therefore the browser
# does not request those CSS resources independently.
pagespeed EnableFilters inline_css;
#pagespeed CssInlineMaxBytes bytes;

# When the 'Inline Google Fonts API CSS' filter is enabled, the contents of the
# small external CSS resources produced to load the fonts are written directly
# into the HTML document; the browser does not need to request those CSS
# resources independently.
pagespeed EnableFilters inline_google_font_css;

# 'Combine JavaScript' seeks to reduce the number of HTTP requests made by a
# browser during page refresh by replacing multiple distinct JavaScript files
# with a single one.
pagespeed EnableFilters combine_javascript;
#pagespeed MaxCombinedJsBytes MaxBytes;
#pagespeed MaxSegmentLength 250;
#pagespeed CombineAcrossPaths off;


# This affects filters rewrite_javascript, combine_javascript,
# inline_javascript, extend_cache, and extend_cache_scripts.
#
# Off by default, turn it on if something looks wrong.
pagespeed AvoidRenamingIntrospectiveJavascript on;

# The contents of small external JavaScript resources are written directly into
# the HTML document; therefore, the browser does not request those JavaScript
# resources.
#pagespeed EnableFilters inline_javascript;

# Detects GIF and PNG images used as backgrounds in CSS. It attempts to combine
# all such images referenced from a CSS file into a single large image.
#
# Requires the 'Rewrite CSS' filter (rewrite_css)
pagespeed EnableFilters sprite_images;

# his filter reduces DNS lookup time by providing hints to the browser at the
# beginning of the HTML, which allows the browser to pre-resolve DNS for
# resources on the page.
pagespeed EnableFilters insert_dns_prefetch;



################################################################################
## Minimize request overhead                                                  ##
################################################################################

# Applies all domain mapping directives specified in pagespeed.conf to web
# resources that are not otherwise rewritten by PageSpeed. For example, if a
# resource is not cacheable, or filters which affect the resource are turned
# off, then it still may be desirable to apply domain sharding.
pagespeed EnableFilters rewrite_domains;

#pagespeed MapRewriteDomain domain_to_write_into_html
#                           domain_specified_in_html;


################################################################################
## Minimize payload size                                                      ##
################################################################################

# Reduces bytes transmitted in an HTML file by removing unnecessary whitespace.
pagespeed EnableFilters collapse_whitespace;

# Combines multiple heads into one
#pagespeed EnableFilters combine_heads;

# Reduces the transfer size of HTML files by removing attributes from tags when
# the specified value is equal to the default value for that attribute
#pagespeed EnableFilters elide_attributes;

# Minifies JavaScript code, using an algorithm similar to that in Douglas
# Crockford's popular JSMin program
pagespeed EnableFilters rewrite_javascript;

# This is equivalent to enabling inline_images, recompress_images,
# convert_png_to_jpeg, and resize_images.
#
# In every case, the image on the page is replaced by the optimized version only
# if the optimized version is actually smaller than the original.
pagespeed EnableFilters rewrite_images;

# This rewriter improves page render times by identifying CSS rules needed to
# render the page, inlining those critical rules and deferring the load of the
# full CSS resources.
pagespeed EnableFilters prioritize_critical_css;

# Reduce the transfer size of HTML files by eliminating redundant image data URLs.
pagespeed EnableFilters dedup_inlined_images;

# Eliminates HTML comments
pagespeed EnableFilters remove_comments;
#pagespeed RetainComment " google_ad_section*";

# The quote removal filter eliminates unnecessary quotation marks
# (either "" or '') from HTML attributes. 
#pagespeed EnableFilters remove_quotes;

# Parse linked and inline CSS, rewrites the images found and minifies the CSS.
# The filter works on CSS found in <style> blocks and <link> refs.
pagespeed EnableFilters rewrite_css;
pagespeed EnableFilters fallback_rewrite_css_urls;

# Rewrites the CSS inside elements' style attributes as performed by
# rewrite_css, which includes CSS minification, image rewriting, image
# recompression, and cache extension, if enabled.
# If both are enabled, rewrite_style_sttributes takes precedence.
pagespeed EnableFilters rewrite_style_attributes;
#pagespeed EnableFilters rewrite_style_attributes_with_url;

# Trims URLs by resolving them by making them relative to the base URL for the
# shortened to "foo"
pagespeed EnableFilters trim_urls;


################################################################################
## Optimize browser rendering                                                 ##
################################################################################

# Adds a response header that matches each meta tag with an http-equiv attribute.
# For example, <meta http-eqiv="Content-Language" content="fr"> would be
# converted to Content-Language: fr in the response headers.
# The original tag is left unchanged.
pagespeed EnableFilters convert_meta_tags;

# Tries to defer JavaScript execution until page load. It defers this by
# changing the type and src attributes of <script> elements on the HTML page
pagespeed EnableFilters defer_javascript;

# Generates low quality versions of the images that are inlined in the HTML page. 
pagespeed EnableFilters inline_preview_images;
pagespeed EnableFilters resize_mobile_images;
#pagespeed MaxInlinedPreviewImagesIndex IndexNumber;
#pagespeed MinImageSizeLowResolutionBytes MinBytes;

# Optimize browser rendering and reduce number of HTTP round-trips by deferring
# the loading of images which are not in the client's viewport. 
#
# This breaks Orbit slider as at Foundation 5.2.1
#pagespeed EnableFilters lazyload_images;

# Reduce the number of times the browser must re-flow the document by ensuring
# that the CSS styles are all parsed in the head, 
#pagespeed EnableFilters move_css_to_head;


################################################################################
## CSS Filters                                                                ##
################################################################################


################################################################################
## JavaScript Filters                                                         ##
################################################################################


################################################################################
## Image Filters                                                              ##
################################################################################




# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
  add_header "" "";
}

location ~ "^/ngx_pagespeed_static/" { 
    
}

location ~ "^/ngx_pagespeed_beacon$" { 
    
}

location /pagespeed_console {
    allow 127.0.0.1;
    deny all;
}

location /ngx_pagespeed_statistics { 
    allow 127.0.0.1;
    deny all; 
}

location /ngx_pagespeed_global_statistics { 
    allow 127.0.0.1;
    deny all; 
}

location /ngx_pagespeed_message { 
    allow 127.0.0.1;
    deny all; 
}


--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.

Wilfred Khalik

unread,
May 2, 2014, 12:47:23 AM5/2/14
to ngx-pagesp...@googlegroups.com


Thanks a lot again Gawain.

Cheers,
Wilfred.

Wilfred Khalik

unread,
May 2, 2014, 1:22:27 AM5/2/14
to ngx-pagesp...@googlegroups.com

Just a heads-up on a few things that I have tested on an Ubuntu System - Ubuntu 12.04 LTS.


1. In order to fire-up Nginx you need to enter the following command: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

You can then verify that Nginx is working by entering your servers IP address on the web browser and seeing the Nginx Welcome Screen

2. In order to reload Nginx after making Nginx configuration changes you need to enter this : /usr/local/nginx/sbin/nginx -s reload -c /usr/local/nginx/conf/nginx.conf

3. In order to kill the dog that is Nginx or to do a fast shutdown use this baby: /usr/local/nginx/sbin/nginx -s quit -c /usr/local/nginx/conf/nginx.conf


Now this looks awfully long so I'll see if I can or if someone else can do up a script fer this.

Cheers,
Wilfred.

Gawain Lynch

unread,
May 2, 2014, 1:31:02 AM5/2/14
to ngx-pagesp...@googlegroups.com
To be honest, binary packages are better suited to most requirements.  I just had a quick look and couldn't find any (up to date) for Ubuntu — I've already advertised my repo for CentOS.

But It would be very nice to have an official Google Yum/Apt repo for this...  Hint, hint guys ;-)

Wilfred Khalik

unread,
May 2, 2014, 1:36:06 AM5/2/14
to ngx-pagesp...@googlegroups.com

Good Idea Gawain - I will try my best to fork out the time to work on one.I was also thinking of doing one fer Memcached.

Jeff Kaufman

unread,
May 5, 2014, 2:43:27 PM5/5/14
to ngx-pagesp...@googlegroups.com
On Fri, May 2, 2014 at 1:31 AM, Gawain Lynch <gawain...@gmail.com> wrote:
> But It would be very nice to have an official Google Yum/Apt repo for
> this... Hint, hint guys ;-)

That would be nice. The main reason we haven't done this yet is that
then we need to (a) be completely on top of nginx security releases so
we have a new build of nginx+pagespeed ready as soon as possible and
(b) figure out what modules to include in our build. Plus the time
involved in setting it up, of course.
Reply all
Reply to author
Forward
0 new messages