# Urgent proxy\_pass

**URL:** <https://www.ruby-forum.com/t/urgent-proxy-pass/208026>\
**Category:** NGINX\
**Created:** [June 8, 2011, 4:15pm UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026 "2011-06-08T16:15:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [June 8, 2011, 4:15pm UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026/1 "2011-06-08T16:15:01Z")

</div>

people please help me, I can not run Nginx

root@servidor [~]# proxy\_passRestarting nginx daemon: nginxnginx:  
[emerg] “proxy\_pass” directive is not allowed here in  
/etc/nginx/nginx.conf:45

user nobody;

# no need for more workers in the proxy mode

worker\_processes 1;  
error\_log /var/log/nginx/error.log info;  
worker\_rlimit\_nofile 20480;  
events {  
worker\_connections 5120; # increase for busier servers  
use epoll; # you should use epoll here for Linux kernels 2.6.x  
}  
http {  
server\_name\_in\_redirect off;  
server\_names\_hash\_max\_size 2048;  
server\_names\_hash\_bucket\_size 256;  
include mime.types;  
default\_type application/octet-stream;  
server\_tokens off;  
sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;  
keepalive\_timeout 60;  
gzip on;  
gzip\_vary on;  
gzip\_disable “MSIE [1-6].”;  
gzip\_proxied any;  
gzip\_http\_version 1.1;  
gzip\_min\_length 0;  
gzip\_comp\_level 6;  
gzip\_buffers 16 8k;

# You can remove image/png image/x-icon image/gif image/jpeg if you have

slow CPU  
gzip\_types text/plain text/xml text/css application/x-javascript  
application/xml image/png image/x-icon image/gif image/jpeg  
application/xml+rss text/javascript application/atom+xml;  
ignore\_invalid\_headers on;  
client\_header\_timeout 3m;  
client\_body\_timeout 3m;  
send\_timeout 3m;  
reset\_timedout\_connection on;  
connection\_pool\_size 256;  
client\_header\_buffer\_size 256k;  
large\_client\_header\_buffers 4 256k;  
client\_max\_body\_size 4M;  
client\_body\_buffer\_size 128k;  
request\_pool\_size 32k;  
output\_buffers 4 32k;  
postpone\_output 1460;  
proxy\_temp\_path /tmp/nginx\_proxy/;  
proxy\_pass [http://127.0.0.1:8081](http://127.0.0.1:8081);  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
client\_body\_in\_file\_only on;  
log\_format bytes\_log “$msec $bytes\_sent .”;  
include “/etc/nginx/vhosts/\*”;  
}

Posted at Nginx Forum:

> **[Urgent proxy\_pass](https://forum.nginx.org/read.php?2,204998,204998#msg-204998)**
>
> people please help me, I can not run Nginx root@servidor \[~\]# proxy\_passRestarting nginx daemon: nginxnginx: \[emerg\] "proxy\_pass" directive is not allowed here in /etc/nginx/nginx.conf:45 user nobody; # no need for more workers in the p

---

<div class="post-metadata">

**Author:** ![baurusites](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@baurusites](https://www.ruby-forum.com/u/baurusites)\
**Post date:** [June 8, 2011, 4:21pm UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026/2 "2011-06-08T16:21:51Z")

</div>

On 06/08/2011 04:14 PM, baurusites wrote:

> people please help me, I can not run Nginx
> 
> root@servidor [~]# proxy\_passRestarting nginx daemon: nginxnginx:  
> [emerg] “proxy\_pass” directive is not allowed here in  
> /etc/nginx/nginx.conf:45

replace this:

proxy\_temp\_path /tmp/nginx\_proxy/;  
proxy\_pass [http://127.0.0.1:8081](http://127.0.0.1:8081);  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;

with this:

location / {  
proxy\_temp\_path /tmp/nginx\_proxy/;  
proxy\_pass [http://127.0.0.1:8081](http://127.0.0.1:8081);  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
}

proxy\_pass is not allowed in http context, you need a location block.  
See [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpProxyModule#proxy_pass)

Hope this helps,  
John

---

<div class="post-metadata">

**Author:** ![baurusites](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@baurusites](https://www.ruby-forum.com/u/baurusites)\
**Post date:** [June 8, 2011, 4:26pm UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026/3 "2011-06-08T16:26:10Z")

</div>

On a second look, you’re also missing a server block and screwed up some  
others…

Have a look at [Full Example Configuration | NGINX](http://wiki.nginx.org/FullExample) and read the primer at  
[Nginx Configuration Primer](http://blog.martinfjordvald.com/2010/07/nginx-primer/) to get an idea.

Regards,  
John

---

<div class="post-metadata">

**Author:** ![baurusites](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@baurusites](https://www.ruby-forum.com/u/baurusites)\
**Post date:** [June 8, 2011, 4:53pm UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026/4 "2011-06-08T16:53:25Z")

</div>

On 8 Jun 2011 15h31 WEST, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> events {  
> sendfile on;  
> gzip\_buffers 16 8k;  
> reset\_timedout\_connection on;  
> proxy\_temp\_path /tmp/nginx\_proxy/;  
> proxy\_pass [http://127.0.0.1:8081](http://127.0.0.1:8081);  
> proxy\_set\_header Host $host;  
> proxy\_set\_header X-Real-IP $remote\_addr;  
> proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
> }  
> client\_body\_in\_file\_only on;  
> log\_format bytes\_log “$msec $bytes\_sent .”;  
> include “/etc/nginx/vhosts/\*”;  
> }

Location directive context is _server_, not http:

Cf. [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpCoreModule#location)

Why are you compressing already compressed image formats like JPEG and  
PNG? Seems to me like a waste of CPU cycles.

Also you can use:

gzip\_disable “msie6”

Cf. [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpGzipModule#gzip_disable)

— appa

---

<div class="post-metadata">

**Author:** ![baurusites](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@baurusites](https://www.ruby-forum.com/u/baurusites)\
**Post date:** [June 8, 2011, 4:32pm UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026/5 "2011-06-08T16:32:22Z")

</div>

root@servidor [/]# service nginx restart  
Restarting nginx daemon: nginxnginx: [emerg] “location” directive is not  
allowed here in /etc/nginx/nginx.conf:45  
already running.

user nobody;

# no need for more workers in the proxy mode

worker\_processes 1;  
error\_log /var/log/nginx/error.log info;  
worker\_rlimit\_nofile 20480;  
events {  
worker\_connections 5120; # increase for busier servers  
use epoll; # you should use epoll here for Linux kernels 2.6.x  
}  
http {  
server\_name\_in\_redirect off;  
server\_names\_hash\_max\_size 2048;  
server\_names\_hash\_bucket\_size 256;  
include mime.types;  
default\_type application/octet-stream;  
server\_tokens off;  
sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;  
keepalive\_timeout 60;  
gzip on;  
gzip\_vary on;  
gzip\_disable “MSIE [1-6].”;  
gzip\_proxied any;  
gzip\_http\_version 1.1;  
gzip\_min\_length 0;  
gzip\_comp\_level 6;  
gzip\_buffers 16 8k;

# You can remove image/png image/x-icon image/gif image/jpeg if you have

slow CPU  
gzip\_types text/plain text/xml text/css application/x-javascript  
application/xml image/png image/x-icon image/gif image/jpeg  
application/xml+rss text/javascript application/atom+xml;  
ignore\_invalid\_headers on;  
client\_header\_timeout 3m;  
client\_body\_timeout 3m;  
send\_timeout 3m;  
reset\_timedout\_connection on;  
connection\_pool\_size 256;  
client\_header\_buffer\_size 256k;  
large\_client\_header\_buffers 4 256k;  
client\_max\_body\_size 4M;  
client\_body\_buffer\_size 128k;  
request\_pool\_size 32k;  
output\_buffers 4 32k;  
postpone\_output 1460;

location / {  
proxy\_temp\_path /tmp/nginx\_proxy/;  
proxy\_pass [http://127.0.0.1:8081](http://127.0.0.1:8081);  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
}  
client\_body\_in\_file\_only on;  
log\_format bytes\_log “$msec $bytes\_sent .”;  
include “/etc/nginx/vhosts/\*”;  
}

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,204998,205010#msg-205010](http://forum.nginx.org/read.php?2,204998,205010#msg-205010)

---

<div class="post-metadata">

**Author:** ![baurusites](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@baurusites](https://www.ruby-forum.com/u/baurusites)\
**Post date:** [June 8, 2011, 5:10pm UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026/6 "2011-06-08T17:10:08Z")

</div>

I do not know the correct setup, only wish to run apache and cpanel

I have to configure in apache as well?

root@servidor [/]# service nginx restart  
Restarting nginx daemon: nginxnginx: [emerg] unknown directive “server”  
in /etc/nginx/nginx.conf:10

user nobody;

# no need for more workers in the proxy mode

worker\_processes 1;  
error\_log /var/log/nginx/error.log info;  
worker\_rlimit\_nofile 20480;  
events {  
worker\_connections 5120; # increase for busier servers  
use epoll; # you should use epoll here for Linux kernels 2.6.x  
}  
server {  
server\_name\_in\_redirect off;  
server\_names\_hash\_max\_size 2048;  
server\_names\_hash\_bucket\_size 256;  
include mime.types;  
default\_type application/octet-stream;  
server\_tokens off;  
sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;  
keepalive\_timeout 60;  
gzip on;  
gzip\_vary on;  
gzip\_disable “MSIE [1-6].”;  
gzip\_proxied any;  
gzip\_http\_version 1.1;  
gzip\_min\_length 0;  
gzip\_comp\_level 6;  
gzip\_buffers 16 8k;

# You can remove image/png image/x-icon image/gif image/jpeg if you have

slow CPU  
gzip\_types text/plain text/xml text/css application/x-javascript  
application/xml image/png image/x-icon image/gif image/jpeg  
application/xml+rss text/javascript application/atom+xml;  
ignore\_invalid\_headers on;  
client\_header\_timeout 3m;  
client\_body\_timeout 3m;  
send\_timeout 3m;  
reset\_timedout\_connection on;  
connection\_pool\_size 256;  
client\_header\_buffer\_size 256k;  
large\_client\_header\_buffers 4 256k;  
client\_max\_body\_size 4M;  
client\_body\_buffer\_size 128k;  
request\_pool\_size 32k;  
output\_buffers 4 32k;  
postpone\_output 1460;  
proxy\_temp\_path /tmp/nginx\_proxy/;  
proxy\_pass [http://127.0.0.1:8081](http://127.0.0.1:8081);  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
client\_body\_in\_file\_only on;  
log\_format bytes\_log “$msec $bytes\_sent .”;  
include “/etc/nginx/vhosts/\*”;  
}

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,204998,205026#msg-205026](http://forum.nginx.org/read.php?2,204998,205026#msg-205026)

---

<div class="post-metadata">

**Author:** ![baurusites](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@baurusites](https://www.ruby-forum.com/u/baurusites)\
**Post date:** [June 9, 2011, 1:41am UTC](https://www.ruby-forum.com/t/urgent-proxy-pass/208026/7 "2011-06-09T01:41:07Z")

</div>

for the love of God helps …

will I have to reinstall everything again?

Posted at Nginx Forum:

> **[Re: Urgent proxy\_pass](https://forum.nginx.org/read.php?2,204998,205132#msg-205132)**
>
> people please help me, I can not run Nginx root@servidor \[~\]# proxy\_passRestarting nginx daemon: nginxnginx: \[emerg\] "proxy\_pass" directive is not allowed here in /etc/nginx/nginx.conf:45 user nobody; # no need for more workers in the p
