Help with site setup!

setup
bug
htaccess

#1

Ok so today I got a new VPS server due to the fact a huge amount of domains were pointed to my old domain - I have no previous domains pointing to my new IP. I now have setup the server with ubuntu 16.04 - previous being Centos 7. I have tried everything to get .htacccess to work and my Virtual Hosts. Here below I have linked all the files!

.htaccess https://pastebin.ubuntu.com/25622957/ 
000-default.conf https://pastebin.ubuntu.com/25622958/ 
apache2.conf https://pastebin.ubuntu.com/25622964/

My question is what have I setup wrong here and the goal is I want to make sure if any domain is pointed to my Origin it will automatically rewrite to mydomain.com - I also want to have my Origin IP also either deny access or rewrite to the main site. I also am not sure how to check if my rewrites are even working as between different browsers different actions happen.


#2

Here are clickable versions of those links:

.htaccess
https://pastebin.ubuntu.com/25622957/

000-default.conf
https://pastebin.ubuntu.com/25622958/

apache2.conf
https://pastebin.ubuntu.com/25622964/


#3

What I’m seeing is having a 000-default.conf file makes it so your server will respond to requests that don’t match your domain. The file even says ServerName is not decisive because the default conf file is used as a last resort to answer queries.

Maybe an Apache expert can chime in and say that you should just eliminate this default.conf file so any request that doesn’t match a VirtualHost in a domain.conf file won’t get answered. So then you’ll have to have a specific domain.conf file for what you’re hosting on the server.

As an aside, if you’re concerned about other domains pointing to your origin IP address, I’d set up a firewall to block all Port 80 and 443 requests that don’t come from a Cloudflare IP address. 1) This will mitigate attacks on your exposed origin IP address. 2) Significantly reduces the chances of someone “cloning” your site. Though my opinion is that the previous issue you faced was unintentionally caused by an abandoned domain that pointed to your IP address that used to serve their domain.


#4

Yes this sounds good, thank you for the reply - How would I firewall and only accept cloudflare IP?


#5

Someone wrote a script to do this:


#6

Ok interesting - If i am to run this and follow the instructions would this stop apache from working as it would remove the firewall rules for apache?


#7

firstly I cant find anywhere to post a new question in a different category, instead I am responding to someone else discussion my intent was to create a new one. sorry but this blog is confusing and I dont see a new post button anywhere. I need to find a developer or a real person not blog articles to help me setup my cloudflare account. my site is running poorly due to plugins config etc. I am happy to pay someone But want trust worthy person. Does cloudflare offer paid support. You have this massive team listed but no real person to contact. I even called your USA number only to be told by a recorded message to come here.


#8

Hi Katie, Shoot me an email at [email protected] and to be able to post on this forum you must comment on other peoples posts and help others out or lend advice etc, I believe it needs to be better documentated! I am about right now and can help you sort all your website problems!