ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    NGINX config issues

    IT Discussion
    3
    4
    335
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Markferron
      last edited by

      I'm trying to get a moodle website up but I can't figure out why my HTTPS redirect isn't completely working. When I go to my.testingtesting.com (changed for privacy) it changes it to https://my.testingtesting.com but it replaces the URL with the local IP address no matter if I am on campus or off campus.
      I have an A record (through dnsmadeeasy) pointing my.testingtesting.com to one of the public IP addresses we have, and on my firewall I have a 1:1 NAT entry pointing that public IP to our private IP (10.0.0.40). Here's what I have in the /etc/nginx/sites-available/moodle configuration:

      server {
          listen 80;
          server_name my.testingtesting.com www.my.testingtesting.com;
          return 301 https://my.testingtesting.com$request_uri;
      }
      
      server {
          listen 443 ssl;
          ssl_certificate  /etc/nginx/bundle.cer;
          ssl_certificate_key /home/itmoodle/server.key;
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
          root /var/www/moodle;
          index  index.php index.html index.htm;
          server_name my.testingtesting.com;
      
          location /dataroot/ {
            internal;
            alias /var/www/moodledata/;
          }
      
          client_max_body_size 100M;
          autoindex off;
      
          location ~ [^/].php(/|$) {
              include snippets/fastcgi-php.conf;
              fastcgi_pass unix:/run/php/php7.4-fpm.sock;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              include fastcgi_params;
              }
      }
      

      Thanks in advance.

      EddieJenningsE 1 Reply Last reply Reply Quote 0
      • EddieJenningsE
        EddieJennings @Markferron
        last edited by

        @Markferron said in NGINX config issues:

        When I go to my.testingtesting.com (changed for privacy) it changes it to https://my.testingtesting.com but it replaces the URL with the local IP address no matter if I am on campus or off campus.

        I want to make sure I understand the problem. When you request http://my.testingtesting.com you receive a 301 redirect https://1.2.3.4 ?

        M 1 Reply Last reply Reply Quote 0
        • M
          Markferron @EddieJennings
          last edited by

          @EddieJennings said in NGINX config issues:

          I want to make sure I understand the problem. When you request http://my.testingtesting.com you receive a 301 redirect https://1.2.3.4 ?

          ...You know what. I think I have bigger problems. My machine off campus all of a sudden cannot ping the FQDN. When I remote into campus and ping the website I get the public IP address. Ugh, well I guess ignore this, maybe it'll straighten itself out once I fix this issue.

          scottalanmillerS 1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller @Markferron
            last edited by

            @Markferron said in NGINX config issues:

            @EddieJennings said in NGINX config issues:

            I want to make sure I understand the problem. When you request http://my.testingtesting.com you receive a 301 redirect https://1.2.3.4 ?

            ...You know what. I think I have bigger problems. My machine off campus all of a sudden cannot ping the FQDN. When I remote into campus and ping the website I get the public IP address. Ugh, well I guess ignore this, maybe it'll straighten itself out once I fix this issue.

            Use DNS to test what the FQDN is pointing to. Pings are always by IP, so if it doesn't work then it is the wrong IP.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post