Quantcast
Channel: Proxmox Support Forum
Viewing all articles
Browse latest Browse all 170710

[nginx + apache]

$
0
0
hi,

i can't running nginx as reverse proxy for apache on proxmox

i got a 502 bad gateway error and

Code:

connect() failed (111: Connection refused) while connecting to upstream, client: xxx, server: www.domain, request: "GET / HTTP/1.1", upstream: "http://MYIP:8080/", host: "www.domain"
on the host i allow the port 80 and 8080

i use nat like this on host:

Code:

        /sbin/iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.0.1:80
        /sbin/iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 8080 -j DNAT --to 192.168.0.1:8080

here my apache conf on guest:

Code:

<VirtualHost 0.0.0.0:8080>
    ServerName www.domain
    DocumentRoot /home/www/domain
    ErrorDocument 404 http://www.domain
    CustomLog /var/log/apache2/domain.access_log combined
    Errorlog /var/log/apache2/domain.error_log
    <IfModule mod_php5.c>
        php_value display_errors Off
        php_value error_reporting 6143
        php_value xdebug.default_enable 0
    </IfModule>
    <Location />
        Allow from all
    </Location>
    <Location /.htaccess>
    Deny from all
    </Location>
    <Directory /home/www/domain>
        Options FollowSymlinks
        AllowOverride All
    </Directory>
    <IfModule mod_ssl.c>
        SSLEngine off
    </IfModule>
</VirtualHost>

and the nginx conf:
Code:

user www-data;
worker_processes 2;

error_log /var/log/nginx/error_log error; #default: error

events {
    worker_connections  1024;
    use epoll;
}

http {

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main
        '$remote_addr - $remote_user [$time_local] '
        '"$request" $status $bytes_sent '
        '"$http_referer" "$http_user_agent" '
        '"$gzip_ratio"';

    client_body_buffer_size 2048k;   
       
    client_header_timeout 3m;
    client_body_timeout 3m;
    send_timeout 3m;
   
    connection_pool_size 256;
    client_header_buffer_size 1k;
    large_client_header_buffers 4 2k;
    request_pool_size 4k;

    gzip on;
    gzip_min_length 1000;
    gzip_comp_level 9;
    gzip_proxied any;

    gzip_buffers 4 8k;
    gzip_types text/css application/x-javascript \
        text/xml application/xml application/xml+rss text/javascript application/x-plist
    application/atom_xml image/svg+xml application/xhtml+xml;
   
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_vary on;

    output_buffers 1 32k;
    postpone_output 1460;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    keepalive_timeout 5 5;

    ignore_invalid_headers on;

    index index.html;

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

and

Code:

server {

    listen 80;
    server_name www.domain;
    access_log /var/log/nginx/domain.access_log main;
    error_log /var/log/nginx/domain.error_log info;
   
    location / {
        proxy_pass http://192.168.0.1:8080;
        proxy_redirect default;
        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_connect_timeout      600;
        proxy_send_timeout          600;
        proxy_read_timeout          600;
        send_timeout                600;
        proxy_intercept_errors on;
    }
   
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|pdf)$ {
        root  /home/www/domain;
    }
}

don't see my error...

++

Viewing all articles
Browse latest Browse all 170710

Trending Articles



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