C
C
chelkaz2016-12-23 12:13:15
Nginx
chelkaz, 2016-12-23 12:13:15

How to find out where the request goes by Domain?

I go to the server by domain and get

Forbidden
Access denied.

DNS is registered correctly on this server.
How to find out where it throws me in the server? nginx and httpd error logs are empty, in httpd access only "GET / HTTP/1.0" 403 118 "-" "Mozilla/5.0
In nginx now:
prefix _ in server_name _; doesn't it mean from any domains?
# Default website
  server {

    listen 80 default_server;
    server_name _;
    server_name_in_redirect off;

    proxy_set_header	X-Real-IP        $remote_addr;
    proxy_set_header	X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header	Host $host:80;

    set $proxyserver	"http://127.0.0.1:8888";
    set $docroot		"/home/bitrix/www";

    index index.php;
    root /home/bitrix/www;

    # Redirect to ssl if need
    if (-f /home/bitrix/www/.htsecure) { rewrite ^(.*)$ https://$host$1 permanent; }

    # Include parameters common to all websites
    include bx/conf/bitrix.conf;

    # Include server monitoring locations
    include bx/server_monitor.conf;
  }

Here is the complete one:
/etc/nginx/nginx.conf
user bitrix;
worker_processes 8;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 10240;

events {
  use epoll;
  worker_connections  10240;
}

http {

  include /etc/nginx/mime.types;
  default_type application/force-download;
  server_names_hash_bucket_size 128;

  # Description of supported access log formats
  log_format main	'$remote_addr - $remote_user [$time_local - $upstream_response_time] '
                  '$status "$request" $body_bytes_sent '
                  '"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';

  log_format common '$remote_addr - - [$time_local - $upstream_response_time] '
                    '"$request" $status $bytes_sent '
                    '"$http_referer" "$http_user_agent" $msec';

  log_format balancer '$remote_addr - $remote_user [$time_iso8601] "$host" '
                    '"$request" $status $body_bytes_sent "schema: $scheme" '
                    '"$http_referer" "$http_user_agent" "$http_x_forwarded_for" '
                    '"$request_length" : "$request_time" -> $upstream_response_time';

  log_format debug '$upstream_response_time,"$time_local","$remote_addr","$request",$status,$body_bytes_sent';


  # upload default maps
  include bx/maps/*.conf;

  # Disable request logging in nginx by default
  #access_log /var/log/nginx/access.log  common;
  access_log			off;

  sendfile			on;
  tcp_nopush			on;
  tcp_nodelay			on;

  client_max_body_size		1024m;
  client_body_buffer_size		4m;

  # Parameters for back-end request proxy
  proxy_connect_timeout		300;
  proxy_send_timeout		300;
  proxy_read_timeout		300;
  proxy_buffer_size		64k;
  proxy_buffers			8 256k;
  proxy_busy_buffers_size		256k;
  proxy_temp_file_write_size	10m;

  # Assign default error handlers
  error_page 500 502 503 504 /500.html;
  error_page 404 = /404.html;

  # Content compression parameters
  gzip				on;
  gzip_proxied			any;
  gzip_static			on;
  gzip_http_version		1.0;
  gzip_types			application/x-javascript application/javascript text/css;

  add_header "X-Content-Type-Options" "nosniff";
  add_header X-Frame-Options SAMEORIGIN;

  # Set nginx-push-stream-module common parameters
  include bx/conf/im_settings.conf;


  # Set default website
  include bx/site_enabled/*.conf;

  # Set additional websites
  include bx/site_ext_enabled/*.conf;
}

This is the nginx site in bx/site_ext_enabled/
# Default website
  server {

    listen 80 default_server;
    server_name _;
    server_name_in_redirect off;

    proxy_set_header	X-Real-IP        $remote_addr;
    proxy_set_header	X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header	Host $host:80;

    set $proxyserver	"http://127.0.0.1:8888";
    set $docroot		"/home/bitrix/www";

    index index.php;
    root /home/bitrix/www;

    # Redirect to ssl if need
    if (-f /home/bitrix/www/.htsecure) { rewrite ^(.*)$ https://$host$1 permanent; }

    # Include parameters common to all websites
    include bx/conf/bitrix.conf;

    # Include server monitoring locations
    include bx/server_monitor.conf;
  }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Mikhalev, 2016-12-23
@Endru9

So you have a permissions error!
if you place the files exactly in the /home/bitrix/ directory, then most likely you need to run both frontend and backend on behalf of the bitrix user. see nginx.conf one of the first lines should be:
+ you should always look at the logs! if you did not specify another directory for logs, then the standard one: /var/log/nginx/

A
Alexander Valle, 2016-12-23
@v1pby

Enable logging in the proxy config, then the logs will be .access_log and error_log.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question