Nginx 403 Error (FIXED)


  • | 1484 points

    After installing the full version of Laragon equip with Nginx, I cannot access any of my websites. I simply get a 403 error. I'm running Windows 10 Enterprise and my permissions seem correct. This is a fresh, clean installation.

    What additional information can I provide to help? Thanks!


  • administrators
    | 43892 points

    @MightyRufo: There is an error.log file (Menu > nginx > error.log). On the file, you'll find the reasons of 403 error.


  • | 1484 points

    The error that I receive in said file is "12492#10748: *10 access forbidden by rule, client: 192.168.1.93, server: localhost, request: "GET / HTTP/1.1", host: "192.168.1.93""

    This leads me to believe that a setting within ngnix is not allowing access. What does this look like to you, Leo?


  • administrators
    | 43892 points

    @MightyRufo: That's the point. You should change your nginx's server setting to allow access from 192.168.1.93
    Google is your friend, if not please feel free to ask :)


  • | 1484 points

    I did try googling for it, but I had trouble finding what settings to change as there are mixed fixes for this problem. How do I allow access to a URL or IP Address?


  • administrators
    | 43892 points

    Open your virtual host/server (Menu > nginx > sites-enabled > auto.xxx.dev.conf)
    Add

        allow  all;
    

    below proper location directives (or all of them if you are not sure);

    location / {
        allow  all;
        try_files $uri $uri/ /index.php$is_args$args;
    }
    
    location ~ \.php$ {
        allow  all;
        include snippets/fastcgi-php.conf;
        fastcgi_pass php_upstream;		
        #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
    

    Reload nginx and check if it works.
    If yes, test again, in that case just allow a specific IP:

    allow 1192.168.1.93;  
    

  • | 1484 points

    Well, I had to apply those settings to the default conf file and it worked! You are awesome Leo! However, now I can't seem to get Nginx to serve a webpage. I'm trying to access wordpress here. The address seems correct, but my browser just seems to endlessly try to load the webpage. There are no errors in the log file, so i'm at a loss.


  • administrators
    | 43892 points

    @MightyRufo : I don't know why it happened to you because default installation of Laragon doesn't require users to do any further settings.

    I suggest you to test with a blank installation of Laragon 2.2.2 (you can keep the previous one) by:

    1. Exit current Laragon
    2. Install Laragon's Nginx to C:\lara
    3. Test Quick Create website with Wordpress

  • | 1484 points

    I did exactly as you mentioned, and i'm still left with the same result. apche works great! I used that for a while, but now i was looking forward to the speed benefits.

    I'll install it on another computer and see how it fairs there.

    EDIT: hmm, I installed it on a different machine and it works. That's very odd. I'll have to see what I can do. Thanks for the help Leo!


  • administrators
    | 43892 points

    Strange, no one reports the same issue as yours. I'll see your result on another computer/VM


  • | 1484 points

    The problem seems to have gone away.. somehow.. for some unknown reason.. out of nowhere... I mean that's cool..

    So, uh, it's fixed! lmao


  • administrators
    | 43892 points

    Cool! glad to hear it worked :D


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.