Score:0

403 FOrbidden index with nginx

ar flag

Good evening. I have this error when I try to access my wordpress from my-no-ipdomain:port/danapcu.com (where wordpress it's installed: /var/www/html/danapcu.com). In addition, my nginx default port is 85 (so my wordpress is supposed to be accessed on this port: 85, because the port 80 is occupied by apache serving my owncloud). Well, when I acces my-noip.domain.net:18601/danapcu.com (the port is mapped in moy router like this: http protocol internal port: 85 - external port:18601 - localip (raspberrypi's ip)). I get first a redirectioning: my-noip.domain.net:85/danapcu.com - error - then I manually change the port to 18601 and I get the 403 forbidden error. In /var/log/nginx/error.log I have this: "*2 directory index of "/var/www/html/danapcu.com/" is forbidden, client: PUBLIC_IP, server: _, request: "GET /danpacu.com/ HTTP/1.1", host: "MYNOIP.DOMAIN.net:18601"

And the structure of my nginx/sites-available/danapcu.com is this one:

server { listen 85; listen [::]:85;

# include snippets/snakeoil.conf;

root /var/www/html/danapcu.com;

# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;

server_name danpacu.com www.danpacu.com;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ /index.php;
    autoindex on;
}

# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
#
#   # With php-fpm (or other unix sockets):
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
#   # With php-cgi (or other tcp sockets):
#   fastcgi_pass 127.0.0.1:9000;
}

Could anyone, please help me understand what is going on, and how could I access my wordpress from my noip domain? Why do I get this redirect to port 85 and then the 403 Forbidden error? Thanks in advance.

Score:0
jp flag

You don't have my-noip.domain.net listed in server_name so your requests don't match that section of the configuration and fall under a default section. See server_name documentation.

dan pacu avatar
ar flag
Hi. THanks a lot for your help. Just declared the no-ip.domain in the /etc/nginx/sites-available/danapcu.com folder, in the server name block. And now I get a 404 Error - Not found. But the folder containing my wordpress is there, in the /var/www/html/danapcu.com/all_the_wordpress_files (index.php included).I access it:http://no-ip-domain:port/danapcu.com.It redirects me to https://box.mydomain.com/danapcu.com(on a different machine I run mailinabox pointing at my public IP). Yet the nginx port on my raspberrypi , is 85-redirected to 18601. Why does it happen? What should I do?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.