Question

My IP SSL unable to shows the contents of my domain

  • Posted October 23, 2021
  • Nginx

I am trying to set up reverse proxy for https for my wordpress domain. So far, the ip with ssl is already set up but there is a problem when i am accessing the link of my article.

For example, the website is : https://example.com and i just create a post with link https://example.com/test_post/ with my ip is : https://111.111.111.111 but when i try to access https://111.111.111.111/test_post/ , it return with 404 Not Found. Can i request for a help to how i can set it so that the ip also can shows everything inside my domain? This is how my line looks like

Thank you very much

server {
        listen 80 default_server;
        server_name _;
        return 301 https://$host$request_uri;
}

server {
        #listen 80 default_server;
        #listen [::]:80 default_server ipv6only=on;

        listen 443 ssl ;
        listen [::]:443 ssl default_server;

        #ssl on;
        ssl_certificate         /etc/nginx/certificate.crt;
        ssl_certificate_key     /etc/nginx/private.key;

        root /var/www/html;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {

                proxy_pass https://example.com;
                proxy_ssl_server_name on;
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.0-fpm.sock;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

I believe that you don’t need the Proxy pass rule. You could try updating it to:

        location / {
                # This is cool because no php is touched for static content.
                # include the "?$args" part so non-default permalinks doesn't break when using query string
                try_files $uri $uri/ /index.php?$args;
        }

Let me know how it goes. Best, Bobby