V
V
Valentine2013-12-15 16:18:04
Nginx
Valentine, 2013-12-15 16:18:04

Nginx: upstream and proxy_pass?

Ubuntu 12.04 x64, DigitalOcean.
Installed nginx+Apache+PHP, static is not given at all, proxy_pass value instead of any urls. Set up according to this guide .
/etc/nginx/nginx.conf

user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
error_log /home/project/logs/nginx.error.log;
events {
        worker_connections 768;
        # multi_accept on;
}
 
http {
 
        ##
        # Basic Settings
        ##
 
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;
 
        server_names_hash_bucket_size 64;
        # server_name_in_redirect off;
 
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
 
        ##
        # Logging Settings
        ##
 
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
 
        ##
        # Gzip Settings
        ##
 
        gzip on;
        gzip_disable "msie6";
 
        # gzip_vary on;
         gzip_proxied any;
         gzip_comp_level 7; #Level Compress
         gzip_buffers 16 8k;
         gzip_http_version 1.1;
         gzip_types text/plain text/css application/json application/x-javascri$
 
        ##
        # Virtual Host Configs
        ##
 
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

/etc/nginx/sites-enabled/project.ru
upstream project {
        server 127.0.0.1:81;
}
server {
        listen          80;
        error_page      404     /404.html;
        error_page      403     /403.html;
        server_name     project.ru www.project.ru;
 
        access_log      /home/project/logs/nginx.access.log;
        error_log       /home/project/logs/nginx.error.log;
 
        location / {
                proxy_pass      http://project;
        }
        location ~* .(jpg|jpeg|gif|png|ico|css|bmp|swf|js|mov|avi|mp4|mpeg4) {
                root /home/project/www;
        }
 
        location ~ /.ht {
                deny all;
        }
}

X7eDWDy.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Sundukov, 2013-12-15
@alekciy

static is not given at all

It can not be.
Why is server not registered as root?
In general, access_log will show whether the request came to nginx at all (maybe problems with DNS, firewall), and error_log will tell you what's wrong.

M
maxaon, 2013-12-15
@maxaon

Most likely, you have an error in the line
most likely instead

location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|mov|avi|mp4|mpeg4)$ {

M
maxaon, 2013-12-15
@maxaon

You are not addressing there, it is necessary not to http://project, but to the addresshttp://project.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question