Missing /etc/nginx/sites-available

Hello,

I’m new to linux and webservers, but I have a brain and C# background.
I installed ngx_pagespeed with nginx on a fresh ubuntu 13.10 following
this
tutorial :
https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
I installed everything under root directory, successfully builded the
package and started nginx :

root@xxxxx:~# service nginx configtest
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is
ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is
successful

root@xxxxx:~# curl -I -p http://localhost|grep X-Page-Speed
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
X-Page-Speed: 1.7.30.3-3721

I have no nginx folder under /etc, therefore I can’t edit
/etc/nginx/sites-available/file_to_edit

I believe this folder comes with the package apt-get install nginx by
default
But how do I edit my .vhost from source build please ?

Thanks !

I’m new to nginx myself, but I’m guessing because you’re not using the
package manager to install nginx. The install location in configured by
the package. Following the build steps in your link…

sed -e “s|%%PREFIX%%|/usr/local/nginx|”
-e “s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|”
-e “s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|”
-e “s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|”
< man/nginx.8 > objs/nginx.8
make[1]: Leaving directory `/tmp/nginx-1.4.4’

Do you see something in /usr/local/nginx? If not, try searching
directly
for the nginx.conf file.

Hi Josh,

Yes, indeed I see inside /usr/local/nginx :

client_body_temp
conf
fastcgi_temp
html
logs
proxy_temp
sbin
scgi_temp
uwsgi_temp

But I don’t understand what is the default.vhost file in it.
If I change :

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;

by :

/usr/local/nginx/conf/.conf;
/usr/local/nginx/html/
;

I get this message :

nginx: [emerg] “worker_processes” directive is not allowed here in
/usr/local/nginx/conf/nginx.conf:3
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

Kinda lost here …

2014-02-10 17:50 GMT+01:00 Josh S. [email protected]:

Hrmm, again I’ve only been using nginx a few days, but you may want to
start googling around. Maybe this link will help?

On Mon, 2014-02-10 at 17:46 +0100, jack linkers wrote:

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax
I have no nginx folder under /etc, therefore I can’t
edit /etc/nginx/sites-available/file_to_edit

I believe this folder comes with the package apt-get install nginx by
default
But how do I edit my .vhost from source build please ?

Thanks !

the sites-available / sites-enabled pair of directories is not something
that comes by default - a number of package managers have used it to
mimic the apache method.

You have installed into /usr/local/nginx, with your config stored in
conf below that, so any includes in nginx.conf are relative
to /usr/local/nginx/conf, unless you put an absolute path in there.

look at the end of the nginx.conf file, and you’ll see

include conf.d/*.conf;

or maybe

include /usr/local/nginx/conf/conf.d/*.conf;

This is the folder where you put your vhosts.

If you want to do it the apache way, add

include sites-enabled/*

and put your config files there.

Alternatively, build your nginx to mimic the default install. I use this
script to build up with pagespeed… you may want to play with it, as
I’m using Amazon linux / 1.5.10 / openssl that supports ECDHE ciphers
and a few other odds and sods ( the starting point is the output from
nginx -V from the version that comes with your distro )

–8<–
./configure --prefix=/etc/nginx
–sbin-path=/usr/sbin/nginx
–conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log
–pid-path=/var/run/nginx.pid
–lock-path=/var/run/nginx.lock
–http-client-body-temp-path=/var/cache/nginx/client_temp
–http-proxy-temp-path=/var/cache/nginx/proxy_temp
–http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
–http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
–http-scgi-temp-path=/var/cache/nginx/scgi_temp
–user=nginx
–group=nginx
–with-openssl-opt=“enable-ec_nistp_64_gcc_128”
–with-http_ssl_module
–with-http_spdy_module
–with-http_realip_module
–with-http_addition_module
–with-http_sub_module
–with-http_gunzip_module
–with-http_gzip_static_module
–with-http_random_index_module
–with-http_secure_link_module
–with-http_stub_status_module
–with-http_dav_module
–with-http_xslt_module
–with-mail
–with-mail_ssl_module
–with-file-aio
–with-debug
–with-sha1=/usr/include/openssl
–with-md5=/usr/include/openssl
–add-module=…/ngx_pagespeed-1.7.30.3-beta
'–with-cc-opt=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic ’
–8<–

hth,

Steve

Steve H. BSc(Hons) MIITP

Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa