Urgent proxy_pass

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;
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:

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;
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;
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 Module ngx_http_proxy_module

Hope this helps,
John

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

Have a look at Full Example Configuration | NGINX and read the primer at
Nginx Configuration Primer to get an idea.

Regards,
John

On 8 Jun 2011 15h31 WEST, [email protected] 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;
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. 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. Module ngx_http_gzip_module

— appa

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;
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:

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;
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:

for the love of God helps …

will I have to reinstall everything again?

Posted at Nginx Forum: