Question

Reposting: im getting "503 Service Temporarily Unavailable nginx" when i do "www." on my website

Posted July 20, 2020 588 views
DNS

im getting “503 Service Temporarily Unavailable nginx” when i do “www.” on my website it is working if i just entered my domain without www. it is working I am using easyengine with wordpress and cloudflare for ssl/dns.
I tried changing cname on DO and Cloudfkare same issue also tried using A with ip still the same issue please help

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.

×
2 answers

hi @bobbyiliev sorry i haven been able to respond to your post i actually found a sulution from easyengine her is the page: https://community.easyengine.io/t/ee-site-create-503-service-temporarily-unavailable/12032/7
thank you again for responding

  • Hi there @Xunne,

    Thank you for sharing your solution with the community! Happy to hear that you’ve got it working by running ee site create www.yourdomain.com --type=wp --ssl=le!

    Regards,
    Bobby

Hi there @Xunne,

It sounds like that your Nginx server block does not include your www. version, can you share the content of the config file here?

It is stored at:

/etc/nginx/sites-enabled/yourdomain.conf

If this is the case, you need to edit that file, add the www version of your site to the server_name list and then restart Nginx.

Let me know how it goes.
Regards,
Bobby

  • hello so i tried to find it but there is no nginx folder on etc, I am using easy engine is it possible that its on a different place?

  • Hello @bobbyiliev so i found nginx configuration i think its on /var/lib/docker/volumes/sitecom_config_nginx/_data/conf.d
    and here is whats inside i added the www. but still no avail:

    # Add your custom config in custom/user.conf
    # ALL CHANGES IN THIS FILE WILL BE LOST AFTER EasyEngine Update
    
    upstream php {
        server site.com_php:9000;
    }
    
    
    server {
        access_log   /var/log/nginx/access.log;
        error_log    /var/log/nginx/error.log;
    
        root /var/www/htdocs;
    
        server_name site.com www.site.com;
    
        index index.php index.html index.htm;
    
    
    
        # PHP NGINX CONFIGURATION
        location / {
            try_files $uri $uri/ /index.php?$args;
        }
        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
            fastcgi_pass php;
        }
    
        # WordPress COMMON SETTINGS
        # Limit access to avoid brute force attack
        location = /wp-login.php {
            limit_req zone=one burst=1 nodelay;
            include fastcgi_params;
            fastcgi_pass php;
        }
        # Disable wp-config.txt
        location = /wp-config.txt {
            deny all;
            access_log off;
            log_not_found off;
        }
        # Disallow php in upload folder
        location /wp-content/uploads/ {
            location ~ \.php$ {
                #Prevent Direct Access Of PHP Files From Web Browsers
                deny all;
            }
        }
    
        # NGINX CONFIGURATION FOR COMMON LOCATION
        # Basic locations files
        location = /favicon.ico {
            access_log off;
            log_not_found off;
            expires max;
        }
    
        location = /robots.txt {
        # Some WordPress plugin gererate robots.txt file
        # Refer #340 issue
            try_files $uri $uri/ /index.php?$args;
            access_log off;
            log_not_found off;
        }
        # Cache static files
        location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|woff2|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ {
            add_header "Access-Control-Allow-Origin" "*";
            access_log off;
            log_not_found off;
            expires max;
        }
        # Security settings for better privacy
        # Allow LetsEncrypt HTTP challenge URL
        location ^~ /.well-known/acme-challenge/ {
            auth_basic off;
            allow all;
            try_files $uri =404;
            break;
        }
        # Deny hidden files
        location ~ /\. {
            deny all;
            access_log off;
            log_not_found off;
        }
    
        # Deny backup extensions & log files
        location ~* ^.+\.(bak|log|old|orig|original|php#|php~|php_bak|save|swo|swp|sql)$ {
            deny all;
            access_log off;
            log_not_found off;
        }
        # Return 403 forbidden for readme.(txt|html) or license.(txt|html) or example.(txt|html)
        if ($uri ~* "^.+(readme|license|example)\.(txt|html)$") {
            return 403;
        }
        # Status pages
        location = /ee-admin/nginx_status {
            stub_status on;
            access_log off;
        }
        location = /ee-admin/status {
            include fastcgi_params;
            fastcgi_pass php;
        }
        location = /ee-admin/ping {
            include fastcgi_params;
            fastcgi_pass php;
        }
        location ~*  \.(css|js)$ {
            expires 1d;
            add_header Cache-Control "public, must-revalidate";
        }
    
    
        client_max_body_size 100m;
    
        include /usr/local/openresty/nginx/conf/custom/*.conf;
    }
    
    edited by bobbyiliev
    • Hi there @Xunne,

      This indeed looks correct. What I could suggest is keeping a CNAME record for your www version to point to your non-www version.

      Besides that, I would also suggest checking your Docker logs to see if there are any errors that could point you to the right direction.

      First, find your Docker container ID:

      • sudo docker ps

      Then get your container ID and run the following command to see your container logs:

      • sudo docker logs -f container_id

      After that visit your website via www and check the logs again.

      Let me know how it goes and feel free to share the output here.
      Regards,
      Bobby

      • Hello @bobbyiliev sorry it took a while for me to reply i got busy with other work, but I did try your suggestion i still cant access www, thank you again for the reply i really dont know what to do with this and here is the out put from the console:

        WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one
        is being generated in the background. Once the new dhparam.pem is in place, nginx will be reloaded.
        forego | starting dockergen.1 on port 5000
        forego | starting nginx.1 on port 5100
        dockergen.1 | 2020/07/16 18:07:54 Generated ’/etc/nginx/conf.d/default.conf’ from 1 containers
        dockergen.1 | 2020/07/16 18:07:54 Running ‘nginx -s reload’
        dockergen.1 | 2020/07/16 18:07:54 Watching docker events
        dockergen.1 | 2020/07/16 18:07:54 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:08:11 Received event start for container e178bcf098f3
        dockergen.1 | 2020/07/16 18:08:11 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:08:50 Received event start for container e67297939b5d
        dockergen.1 | 2020/07/16 18:08:50 Received event start for container 7a18c7116979
        dockergen.1 | 2020/07/16 18:08:50 Generated ’/etc/nginx/conf.d/default.conf’ from 4 containers
        dockergen.1 | 2020/07/16 18:08:50 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:08:53 Received event start for container 01c1e0131ac3
        dockergen.1 | 2020/07/16 18:08:53 Generated ’/etc/nginx/conf.d/default.conf’ from 5 containers
        dockergen.1 | 2020/07/16 18:08:53 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:08:53 Received event die for container 01c1e0131ac3
        dockergen.1 | 2020/07/16 18:08:53 Generated ’/etc/nginx/conf.d/default.conf’ from 5 containers
        dockergen.1 | 2020/07/16 18:08:53 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:08:56 Received event start for container 01c1e0131ac3
        dockergen.1 | 2020/07/16 18:08:56 Generated ’/etc/nginx/conf.d/default.conf’ from 5 containers
        dockergen.1 | 2020/07/16 18:08:56 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:08:56 Received event die for container 7a18c7116979
        dockergen.1 | 2020/07/16 18:08:57 Received event stop for container 7a18c7116979
        dockergen.1 | 2020/07/16 18:08:57 Generated ’/etc/nginx/conf.d/default.conf’ from 4 containers
        dockergen.1 | 2020/07/16 18:08:58 Received event start for container 7a18c7116979
        dockergen.1 | 2020/07/16 18:08:58 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:08:59 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:09:06 Received event die for container 01c1e0131ac3
        dockergen.1 | 2020/07/16 18:09:07 Received event stop for container 01c1e0131ac3
        dockergen.1 | 2020/07/16 18:09:07 Generated ’/etc/nginx/conf.d/default.conf’ from 4 containers
        dockergen.1 | 2020/07/16 18:09:07 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:09:09 Received event start for container 01c1e0131ac3
        dockergen.1 | 2020/07/16 18:09:09 Generated ’/etc/nginx/conf.d/default.conf’ from 5 containers
        dockergen.1 | 2020/07/16 18:09:09 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:09:09 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:09:24 Received event die for container e67297939b5d
        dockergen.1 | 2020/07/16 18:09:24 Received event stop for container e67297939b5d
        dockergen.1 | 2020/07/16 18:09:24 Generated ’/etc/nginx/conf.d/default.conf’ from 4 containers
        dockergen.1 | 2020/07/16 18:09:24 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:09:26 Received event start for container e67297939b5d
        dockergen.1 | 2020/07/16 18:09:26 Generated ’/etc/nginx/conf.d/default.conf’ from 5 containers
        dockergen.1 | 2020/07/16 18:09:26 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:09:26 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:10:06 Received event start for container 5d749b9e6acc
        dockergen.1 | 2020/07/16 18:10:06 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:10:07 Received event die for container 5d749b9e6acc
        dockergen.1 | 2020/07/16 18:10:07 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        Generating DH parameters, 2048 bit long safe prime, generator 2
        This is going to take a long time
        dhparam generation complete, reloading nginx
        dockergen.1 | 2020/07/16 18:10:10 Received event start for container 5d749b9e6acc
        dockergen.1 | 2020/07/16 18:10:10 Generated ’/etc/nginx/conf.d/default.conf’ from 6 containers
        dockergen.1 | 2020/07/16 18:10:10 Running 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:10:10 Received event die for container 5d749b9e6acc
        dockergen.1 | 2020/07/16 18:10:10 Received event stop for container 5d749b9e6acc
        dockergen.1 | 2020/07/16 18:10:11 Received event start for container 5d749b9e6acc
        dockergen.1 | 2020/07/16 18:10:11 Generated ’/etc/nginx/conf.d/default.conf’ from 6 containers
        dockergen.1 | 2020/07/16 18:10:11 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/16 18:10:11 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/21 13:00:41 Received event die for container 01c1e0131ac3
        dockergen.1 | 2020/07/21 13:00:41 Received event stop for container 01c1e0131ac3
        dockergen.1 | 2020/07/21 13:00:41 Generated ’/etc/nginx/conf.d/default.conf’ from 5 containers
        dockergen.1 | 2020/07/21 13:00:41 Running 'nginx -s reload’
        dockergen.1 | 2020/07/21 13:00:43 Received event start for container 01c1e0131ac3
        dockergen.1 | 2020/07/21 13:00:44 Generated ’/etc/nginx/conf.d/default.conf’ from 6 containers
        dockergen.1 | 2020/07/21 13:00:44 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        Custom dhparam.pem file found, generation skipped
        forego | starting dockergen.1 on port 5000
        forego | starting nginx.1 on port 5100
        dockergen.1 | 2020/07/21 13:06:52 Generated ’/etc/nginx/conf.d/default.conf’ from 6 containers
        dockergen.1 | 2020/07/21 13:06:52 Running 'nginx -s reload’
        dockergen.1 | 2020/07/21 13:06:52 Watching docker events
        dockergen.1 | 2020/07/21 13:06:53 Generated ’/etc/nginx/conf.d/default.conf’ from 6 containers
        dockergen.1 | 2020/07/21 13:06:53 Running 'nginx -s reload’
        Custom dhparam.pem file found, generation skipped
        forego | starting dockergen.1 on port 5000
        forego | starting nginx.1 on port 5100
        dockergen.1 | 2020/07/21 13:13:37 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’
        dockergen.1 | 2020/07/21 13:13:37 Watching docker events
        dockergen.1 | 2020/07/21 13:13:38 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload’

        • Hi there @Xunne,

          I can’t see anything that could be causing the error. One thing that comes to my mind is that once you’ve made the DNS change it could take up to 24-48 hours for the DNS cache to clear over the Globe before you could see the changes.

          Are you still seeing that error when visiting your www version?

          If so, when you ping your domain.com and then www.yourdomain.com do you get the same IP address back?

          Regards,
          Bobby

          • Hi @bobbyiliev yup still same issue i tried to ping them both though they have diffrent ip but those 2 ip are from cloud flare so should be okay right?

            Thank you by the way for the reapply i appreciate it, im also at a loss at this ive been trying to do it for 2weeks now

          • Hi there @Xunne,

            Is the 503 error a Cloudflare error or is this an Nginx error that you are seeing?

            Also as you are using Cloudflare, can you set your www version as a CNAME record and point it to your main domain under your Cloudflare DNS.

            On your server, can you run the following command and share the output here:

            sudo netstat -plant | grep LISTEN
            

            Regards,
            Bobby

Submit an Answer