0

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.

dan pacu
  • 1
  • 2

1 Answers1

0

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.

AlexD
  • 8,179
  • 2
  • 28
  • 38
  • 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? – dan pacu Jan 17 '22 at 16:52