nginx: [emerg] unknown directive "pagespeed" in /etc/nginx/nginx.conf:

2,637 views
Skip to first unread message

u.na...@hush.com

unread,
Nov 22, 2013, 1:36:04 PM11/22/13
to ngx-pagesp...@googlegroups.com
Well I just installed by following all steps. But I get this error whatever I try and that's why I still have to use apache since I can't use the site without pagespeed. I'm desperately in need of help.

Note : I use Centos

Best wishes

Jeff Kaufman

unread,
Nov 22, 2013, 1:56:51 PM11/22/13
to ngx-pagesp...@googlegroups.com
There should be a line number in that error message. Does it
correspond to the first usage of "pagespeed" in your conf or a later
one?

If nginx won't start with any usage of "pagespeed" then you're not
running a build of nginx that includes ngx_pagespeed. How are you
starting nginx? What nginx binary does that run? If you run
"/path/to/that/binary/nginx -V" what does it say were the configure
arguments?
> --
> 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/groups/opt_out.

Umit Naimian

unread,
Nov 23, 2013, 11:34:03 AM11/23/13
to ngx-pagesp...@googlegroups.com
It just gives error for the first usage of pagespeed. "pagespeed on"

Well I'm not sure about the binary but I guess the answer is /usr/sbin/nginx

I start it with service nginx start command by the way. Please help me to solve this issue Jeff :/


22 Kasım 2013 Cuma 20:56:51 UTC+2 tarihinde Jeff Kaufman yazdı:
There should be a line number in that error message.  Does it
correspond to the first usage of "pagespeed" in your conf or a later
one?  
nginx version: nginx/1.4.4
 
If nginx won't start with any usage of "pagespeed" then you're not
running a build of nginx that includes ngx_pagespeed.  How are you
starting nginx?  What nginx binary does that run?  If you run
"/path/to/that/binary/nginx -V" what does it say were the configure
arguments?

On Fri, Nov 22, 2013 at 1:36 PM,  <u.na...@hush.com> wrote:
> Well I just installed by following all steps. But I get this error whatever
> I try and that's why I still have to use apache since I can't use the site
> without pagespeed. I'm desperately in need of help.
>
> Note : I use Centos
>
> Best wishes
>
> --
> 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

Umit Naimian

unread,
Nov 23, 2013, 11:35:49 AM11/23/13
to ngx-pagesp...@googlegroups.com
A hint about this issue, which may help to solve it.

ngx_pagespeed path is /root/ngx_pagespeed-1.7.30.1-beta/ I guess. Is this normal?


22 Kasım 2013 Cuma 20:56:51 UTC+2 tarihinde Jeff Kaufman yazdı:
There should be a line number in that error message.  Does it
correspond to the first usage of "pagespeed" in your conf or a later
one?

If nginx won't start with any usage of "pagespeed" then you're not
running a build of nginx that includes ngx_pagespeed.  How are you
starting nginx?  What nginx binary does that run?  If you run
"/path/to/that/binary/nginx -V" what does it say were the configure
arguments?

On Fri, Nov 22, 2013 at 1:36 PM,  <u.na...@hush.com> wrote:
> Well I just installed by following all steps. But I get this error whatever
> I try and that's why I still have to use apache since I can't use the site
> without pagespeed. I'm desperately in need of help.
>
> Note : I use Centos
>
> Best wishes
>
> --
> 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

Umit Naimian

unread,
Nov 23, 2013, 1:21:59 PM11/23/13
to ngx-pagesp...@googlegroups.com
my nginx conf files are under etc/nginx. Just needed to mention about If it's about binary

22 Kasım 2013 Cuma 20:36:04 UTC+2 tarihinde u.na...@hush.com yazdı:

Umit Naimian

unread,
Nov 23, 2013, 1:30:46 PM11/23/13
to ngx-pagesp...@googlegroups.com
Another note,

I previously installed nginx by using yum install nginx command and later installed ngx_pagespeed by following steps here. So  I didn't apply the step "./configure --add-module=$HOME/ngx_pagespeed-1.7.30.1-beta" 

I guess this would be the problem. So any solution?

23 Kasım 2013 Cumartesi 18:35:49 UTC+2 tarihinde Umit Naimian yazdı:

Umit Naimian

unread,
Nov 23, 2013, 1:50:21 PM11/23/13
to ngx-pagesp...@googlegroups.com
Well I feel like I'm spamming here but I urgently need a solution.

I typed configure command under /etc/nginx directory but I get error -bash: ./configure: No such file or directory

I don't know what I'm doing wrong.


22 Kasım 2013 Cuma 20:36:04 UTC+2 tarihinde u.na...@hush.com yazdı:
Well I just installed by following all steps. But I get this error whatever I try and that's why I still have to use apache since I can't use the site without pagespeed. I'm desperately in need of help.

Umit Naimian

unread,
Nov 23, 2013, 2:05:25 PM11/23/13
to ngx-pagesp...@googlegroups.com
brr. I reinstalled and built nginx by following steps on tutorial and run configure. but still unknown directive "pagespeed" in /etc/nginx/conf.d/default.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed


22 Kasım 2013 Cuma 20:36:04 UTC+2 tarihinde u.na...@hush.com yazdı:
Well I just installed by following all steps. But I get this error whatever I try and that's why I still have to use apache since I can't use the site without pagespeed. I'm desperately in need of help.

Joshua Marantz

unread,
Nov 23, 2013, 2:14:36 PM11/23/13
to ngx-pagesp...@googlegroups.com
Hi Umit,

I'm not an expert on this install process but let me offer a suggestion.  I think you will need to install nginx from source in order to add custom modules to it.  You might be running into trouble because you have installed nginx via 'yum' and are getting a binary install.  Because nginx lacks a dynamically loadable module system, you really need to build the ngx_pagespeed gasket into the nginx source, per our instructions here: https://github.com/pagespeed/ngx_pagespeed#readme

Note that in those instructions, it doesn't mention anything about 'yum install nginx'.  You might be able to install vanilla nginx that way but to install ngx_pagespeed you need to re-install nginx by downloading its source and building it (wget http://nginx.org/download/nginx-1.4.3.tar.gz ...)

Hope this helps.
-Josh


--
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.

Umit Naimian

unread,
Nov 23, 2013, 2:19:02 PM11/23/13
to ngx-pagesp...@googlegroups.com
Hi Joshua,

Thanks for the reply. I reinstalled nginx from its source by following all steps on readme. just it was 1.4.4 instead of 1.4.3. But still the same error.

23 Kasım 2013 Cumartesi 21:14:36 UTC+2 tarihinde Joshua Marantz yazdı:
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

Umit Naimian

unread,
Nov 23, 2013, 2:32:22 PM11/23/13
to ngx-pagesp...@googlegroups.com
Also paths seem to be wrong after I typed configure command while building.

 nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"


There is no nginx folder in local. It's in /etc

22 Kasım 2013 Cuma 20:36:04 UTC+2 tarihinde u.na...@hush.com yazdı:
Well I just installed by following all steps. But I get this error whatever I try and that's why I still have to use apache since I can't use the site without pagespeed. I'm desperately in need of help.

Umit Naimian

unread,
Nov 23, 2013, 2:35:28 PM11/23/13
to ngx-pagesp...@googlegroups.com
oops sorry I'm quite amateur. I refreshed and saw nginx folder. So I guess I have 2 nginx installed in different locations. so I guess If I edit conf file under the new path, it will be ok for pagespeed, but then how can I start nginx? I normally start it by service start nginx and it uses etc/nginx location


22 Kasım 2013 Cuma 20:36:04 UTC+2 tarihinde u.na...@hush.com yazdı:
Well I just installed by following all steps. But I get this error whatever I try and that's why I still have to use apache since I can't use the site without pagespeed. I'm desperately in need of help.

Umit Naimian

unread,
Nov 23, 2013, 3:04:34 PM11/23/13
to ngx-pagesp...@googlegroups.com
It feels like I'm talking to myself. Now I managed to run pagespeed but my js files are not loading.


22 Kasım 2013 Cuma 20:36:04 UTC+2 tarihinde u.na...@hush.com yazdı:
Well I just installed by following all steps. But I get this error whatever I try and that's why I still have to use apache since I can't use the site without pagespeed. I'm desperately in need of help.

Jeff Kaufman

unread,
Nov 24, 2013, 9:30:16 AM11/24/13
to ngx-pagesp...@googlegroups.com
I'm glad you got pagespeed working! Could you give more details about
how your js files aren't loding?
> --
> 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.

Umit Naimian

unread,
Nov 24, 2013, 9:48:44 AM11/24/13
to ngx-pagesp...@googlegroups.com
Well it's because of rewrite javascript filter, when I disable it it begins to work but there is something weird. With apache I have about 60-70 requests and it loads in 1.0 ms at max. But with nginx there seems to be about 150 requests and it doesn't load less than 5.0 - 6.0 ms. I don't know what I'm doing wrong again :)

24 Kasım 2013 Pazar 16:30:16 UTC+2 tarihinde Jeff Kaufman yazdı:
I'm glad you got pagespeed working!  Could you give more details about
how your js files aren't loding?

On Sat, Nov 23, 2013 at 3:04 PM, Umit Naimian <unai...@gmail.com> wrote:
> It feels like I'm talking to myself. Now I managed to run pagespeed but my
> js files are not loading.
>
>
> 22 Kasım 2013 Cuma 20:36:04 UTC+2 tarihinde u.na...@hush.com yazdı:
>>
>> Well I just installed by following all steps. But I get this error
>> whatever I try and that's why I still have to use apache since I can't use
>> the site without pagespeed. I'm desperately in need of help.
>>
>>
>> Note : I use Centos
>>
>> Best wishes
>
> --
> 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

Umit Naimian

unread,
Nov 24, 2013, 9:54:37 AM11/24/13
to ngx-pagesp...@googlegroups.com
I suppose sprite images filter doesn't work for me since when I test pagespeed/gtmetrix with apache, there's nothing wrong with sprite images and there are 60 requests. With nginx, sprite doesn't work and probably that's why I get 3x more requests. :/

24 Kasım 2013 Pazar 16:48:44 UTC+2 tarihinde Umit Naimian yazdı:

Umit Naimian

unread,
Nov 24, 2013, 11:15:48 AM11/24/13
to ngx-pagesp...@googlegroups.com
I found out it's nothing related to sprite images, the only reason is "Connect" times are extremely long in nginx. I don't know what to configure

24 Kasım 2013 Pazar 16:54:37 UTC+2 tarihinde Umit Naimian yazdı:
Reply all
Reply to author
Forward
0 new messages