Hi all- I’m getting a funny error. I have an index.php file as the default landing page for my badastronomy.com site, and it redirects to my blog on syfy.com. This is all it is:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: https://www.syfy.com/tags/bad-astronomy" );
?>
I was told this error started popping up around the new year (I rarely check the site, obviously). Has anyone seen anything like this before? What’s funny is that the index.html file on the site works (it’s a very old site, and I keep it around for historical purposes), so I know the server is working. Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
A 502 error is returned when a web server cannot reach an upstream service needed to load the site. Based on this being a PHP site returning a 502 I would guess that you are running Nginx+PHP-FPM on your site rather than Apache with mod_php.
If that is the case then this would indicate that your php-fpm service either isn’t running or is returning an error. On Ubuntu you can find the logs for this process in /var/log/php-fpm
If this domain only redirects to your syfy.com blog and does not serve any other content you can simplify things. PHP would not even be necessary. You can create a 301 redirect directly in your nginx configuration /etc/nginx/sites-enabled/default by following this guide.
Thanks for the info, ryanpq. I’m running Nginx but I’m not sure with what else. I’ve done some server maintenance before but it’s been a while, so I’m not familiar with this setup.
I don’t have a php-fpm file/dir in that location, either. I did a “find” and nothing with the name fhp turns up from my root dir.
As it is, I don’t want all queries to redirect, just ones to the main url. So if they just go to www.badastronomy.com it sends them to my blog, but if they add index.html to the URL they can see the badastronomy.com site. It’s a weird setup but I’m contractually obligated to do this. :/
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.