#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2016
    Posts
    19
    Rep Power
    0

    debugging nginx - adding events directive?


    ok so in my quest to figure out nginx i am trying to add debug but i cant seem to figure out where to place this directive?

    the directive is:

    Code:
    events {
      debug_connection 192.0.0.1;
    }
    I have placed it everywhere possible in the nginx conf but to no avail..

    Code:
    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/url.com/before/*;  #has a server { } directive
    
    server {
       
    
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name url.com;
        root /home/forge/url.com/public;
    
        # FORGE SSL (DO NOT REMOVE!)
        ssl_certificate /etc/nginx/ssl/url.com/123/server.crt;
        ssl_certificate_key /etc/nginx/ssl/url.com/123/server.key;
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
        ssl_prefer_server_ciphers on;
        ssl_dhparam /etc/nginx/dhparams.pem;
    
        client_max_body_size 50M;
    
        index index.html index.htm index.php;
    
        charset utf-8;
    
        # FORGE CONFIG (DOT NOT REMOVE!)
        include forge-conf/dev.afleteapp.com/server/*;  # this has location directive
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
        
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        access_log off;
        error_log  /var/log/nginx/url.com-error.log error;
        
        error_page 404 /index.php;
        
    
    
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }
    
        location ~ /\.ht {
            deny all;
        }
    }
    
    include somefile*; #the file is empty
  2. #2
  3. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,090
    Rep Power
    9644
    events{} goes in the main context, ie. not wrapped in any other {} contexts. Thing is, server{} is used within http{}, which means that file you're looking at is not the one to be editing.

    Somewhere you have a main configuration file with a http{} block (which itself goes in the main context) that's apparently including other files. In that file is where you would put events{}. Before you do that, check if there's a mechanism already to put extra configuration files: look for an include, probably like
    Code:
    # main file
    
    http {
    	include path_to_server_conf_files;
    }
    
    include path_to_somewhere; # if this exists you should put the events conf into a file here
    Note that debug_connection requires a debugging version of nginx. If you built nginx yourself then you need --with-debug, otherwise I'm not sure how to get it in Ubuntu - you might have to build it.

    Comments on this post

    • shez1983 agrees : sorry cant give reps yet :(

IMN logo majestic logo threadwatch logo seochat tools logo