Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

How to compile Nginx from source

$
0
0
Hi all,
I'm Nginx newbie, I read Beginer & Wiki Guide and I want to compile Nginx from source. My Nginx server will work as Web server + Caching + Reverse Proxy (load balancing) , my server Centos 6.4 64 bit.
I downloaded Nginx 1.8.0 from here : http://nginx.org/download/nginx-1.8.0.tar.gz , then I compiled it with option:
<code>
./configure --prefix=/opt/nginx --sbin-path=/opt/nginx/sbin --conf-path=/opt/nginx/conf/ --user=nginx --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --http-log-path=/var/log/nginx/access.log --group=nginx --with-file-aio --with-http_ssl_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre
make
make install
</code>
Nginx was compiled successfully but:
- file "proxy_params" wasn't created
- Nginx cannot understand parameters : ip_hash , max_conns
So I get error when I try to start Nginx:
- [emerg] open() "/opt/nginx/conf/proxy_params" failed (2: No such file or directory) in /opt/nginx/site-enabled/proxy.conf:8
- [emerg] invalid number of arguments in "ip_hash" directive in /opt/nginx/site-enabled/upstreams.conf:5
- [emerg] invalid parameter "max_conns=1024" in /opt/nginx/site-enabled/upstreams.conf:5
This is my proxy.conf and upstreams.conf :
<code>
#proxy.conf
server {
listen 80 default_server;
server_name http-website.com;
server {
listen 80;
server_name https-website.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name staging.mymall.vn;
location / {
proxy_pass http://http;
}
location /static {
proxy_pass http://static;
}
</code>
<code>
#upstreams.conf
upstream http {
server 192.168.200.14:82 max_fails=3 fail_timeout=30s max_conns=1024;
zone http 256k;
keepalive 100;
queue 1024 [timeout=15];
}
upstream static {
ip_hash
server 192.168.200.14:83 max_fails=3 fail_timeout=30s max_conns=1024;
zone http 256k;
keepalive 100;
queue 1024 [timeout=15];
}
</code>
If I exclude proxy.conf and upstreams.conf , Nginx can work as Web server properly.
Please give me some advice, how should I compile Nginx to archive my purpose ?
Thanks in advance.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>