B
B
Binarix2015-09-02 09:14:42
Nginx
Binarix, 2015-09-02 09:14:42

How to add a website to nginx?

Hello. I'm trying to add a site subdomain to nginx, the config is like this

server {				
  error_log /home/<название сайта>/www/log/nginxerror.log;
  access_log /home/<название сайта>/www/log/nginxaccess.log;
  listen       80;
  server_name  <поддомен>.<домен>.ru;
  
  charset utf-8;
  client_max_body_size 10m;

  gzip            on;
  gzip_min_length 1000;
  gzip_buffers    4 8k;
  #gzip_types      text/plain application/xml application/x-javascript text/ja
  gzip_comp_level  8;

  location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|txt)$ {
  root /home/<название сайта>/www/<название сайта>;
  }

  location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    # это для отдельных случаев
    #proxy_buffers 8 64k;
    proxy_connect_timeout 2s;
    proxy_read_timeout 5s; 
    proxy_send_timeout 5s;
  }
}

I restart nginx, but when I try to access the subdomain, I get the main page of the domain (without connected styles and images). What was wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question