Score:0

nginx: why I get access denied when I'm trying to access wordpress?

cn flag

I'm trying to set up WordPress using docker-compose but WordPress has to work in a separated container with php_fpm, a container for MariaDB, and an Nginx in port 443 redirecting to WordPress if the link was HTTPS://localhost/wordpress but if the link was HTTPS://localhost/ it has to send the request to index.html page on the same container.

but I have a problem with the WordPress URL.

I want when nginx to redirect all the requests coming from https:/localhost/wordpress to WordPress container but when I do it gives me an Access denied. page.

meanwhile when I access https://localhost/wordpress/ (I added a / in the last of the URL) the page work fine

my default.conf file:

server {
    listen                  443 ssl;

    ssl_protocols       TLSv1.3;
    ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
      ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

    root                    /var/www/html;
    index                   index.html;
    # index                   index.html index.htm index.php;
    server_name             _;
    # client_max_body_size    32m;
    # error_page              500 502 503 504  /50x.html;

    # autoindex off;
    # index index.php index.html index.htm index.nginx-debian.html;

    # include /etc/nginx/mime.types;
    location = /50x.html {
            root              /var/lib/nginx/html;
    }
    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    index index.html;
    # try_files $uri $uri/ /index.php?$args;
    }
  # pass the PHP scripts to FastCGI server listening on wordpress:9000
    location /wordpress {
    # fastcgi_split_path_info ^(.+\.php)(/.+)$;
    # root  /var/www/html/;
    fastcgi_pass 0.0.0.0:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    }
}

NOTE: I Asked the same question on stackoverflow

djdomi avatar
za flag
`fastcgi_pass 0.0.0.0:9000` looks in my eys wrong,dont xa want to use localhost or a specific IP?
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.