How do I stop my domain name maliciously redirecting? - apache

I have set up my website running on Apache2 on an Ubuntu server. I have two domain names from mydomain.com. I linked them up and they work, usually. But, often, when I try to load the domain name , I get redirected to another advertisement site.
When I load my server IP, it always displays the correct site.
Running: “curl myip” gives me the correct HTML.
Running: “curl www.my-domain-name” gives me...
<HTML><FRAMESET><frame src=“searchvity.com/?dn=“my-domain-name”&pid=9PO1MNJ3”><FRAME src=“blank.html”></FRAMESET></HTML>
Which is someone else.
I do not know how this is happening, or what I could do. It has happened for a while, and doesn’t always happen.
I own two domains and they both redirect to the same site.

Related

What would cause apache to redirect from a local IP to a remote IP address

Here's a scenario that I can't figure out; I simply can't understand why an slightly oldish webserver (totally inactive/powered-off for 2y) is behaving this way. I MUST be overlooking something quite simple.
Specifically, when i try to access an Apache instance on Centos 7 residing on my local network (192.168.2.XXX), the apache page responds just fine (Testing 1,2,3; Yay). Watching the access logs on this simple request shows up fine. On this same machine, I have four additional paths set up. One for example is a locked down phpMyAdmin that is accessible only from an internal IP. This route works fine, and the databases can be browsed, etc. Yet, for the other route, such as a wordpress installation or a route to a Magento instance, the the request comes up on the access log (no error log entry), and then just sits there. When the request finally times out, the URL in the browser changes to a new ip address (ABC.XXX.YYY.ZZZ), and then terminates any efforts.
Admittedly, the machine WAS originally configured to be outward facing, and my suspicion is that the IP to which the pages revert may have been the public IP last time the machine was alive. the IP is no longer associated with the site, and the domain which was likely setup with that IP address, is also no longer active.
Does anyone have any suggestions as to what I may look at? I have combed the httpd configurations and there is nothing resembling any such redirection address. Could there be some DNS data that needs to be flushed? A network configuration in sysconfig/ that I am overlooking?
It was nothing to do with my apache configuration. Everything was related to the site urls that were embedded inside the wordpress and magento installations. Upon finding and replacing all instances of the site IP address in some configuration tables, I was able to get both applications to respond properly.

Google Domain forward to Digital Ocean linux server, running Apache2 subfolder, and display domain as root

I've been googling for a bit now, and I really cant seem to figure this out. I recently bought a domain name with google domains, that I wish to point to a sub domain on my web-server, (example) http://120.0.0.0/sub-folder/, while apearing as domain.com.
Right now I have mbektic.com forwarding to http://138.197.5.88/mbektic/ which kind of gets what I need done, but I wish for the URL to say mbektic.com, instead of the ip address of the server.
Now I've been looking around and I've found things mentioning things from creating records to .htaccess files, and honestly I'm completely lost.
If someone could point me to a straightforward guide or give me a list of steps to follow, I can do it myself, but currently I am just lost.
This really belongs on unix.se since it isn't programming...
That said, what you need to do is set up a DNS A record pointing your domain name to your IP address. Add a second one to handle www.example.com
Then, on the webserver, configure it to respond to that name and serve content out of the directory you specify (the apache webserver calls this the DocumentRoot - you may want to look up apache virtual hosts .... )

ISPConfig and Apache wildcard subdomains issue

I own a VPS with ISPConfig installed. On that VPS we got 4 websites, which are running well, but we have recently spotted problem with Google indexing nonexistent subdomains.
No matter that if you type www.xxx.com or www.xxx.xxx.com or www.yyy.xxx.com or yyy.xxxx.com it will load the main website www.xxx.com, which is, I assume, bad for Google as we give them millions of pages to index. I got to mention that subdomains "xxx" and "yyy" were not preset, in a matter of fact we got no subdomains at all, except "mail", which we use to reach the Roundcube for our websites.
I spotted that the "auto-subdomain" setting for every website is "*." and setted it to "www.", which fixed the issue with redirect but now all subdomains are still reachable - response code is 200 and they show empty pages.
I would like to show 404 error or something like that, not OK status.
Take a look at your dns manager, probably you have an "*" A record with *.xxx.com pointing to your IP address, then if you type this.xxx.com or that.xxx.com, you get www.xxx.com.

Accessing Apache Server from the internet

I have installed Apache on Xubuntu and I am have a problem accessing it from the internet.
If I access it via localhost I can reach the home page plus pages in the subdirectory. How if I access it from the internet I can get the home page but nothing else. When I type in the subdirectory and page, no links at this point, It either never leaves the home page or gets rerouted back to it.
I have no .htaccess files in place, I have tried adding an alias and entries in the conf file and I have checked ownership and permissions. I have gone as far as wiping the machine and starting with the same results.
I feel like it is going to be a case of missing something simple but I cannot think of what. The log files have indicated that an IP tried to access the subdirectory but shows no error in doing so. When typed into the URL the /Directory/Index.html shows in the address bar but it displays the home page.
Can anyone point me in the right direction?
Thanks,
Most likely the issue is contained either in your apache.conf file or your firewall. I would have a good look at your apache.conf to see if there is anything restricting access to your sub-directories.
if you want to use default http port (80), so long story short www.abc.com without explicit port number, you must allow this on your server because 80 is privileged on most system, this could be a problem

Trouble setting up a subdomain on a VPS under Ubuntu and Apache

I'm a complete newbie when it comes to servers, so I need some help. Basically, I want to have a subdomain on my VPS. I'm not too concerned where the files reside, though of course I would like them separated if possible.
I found a guide to doing this that basically sums the procedure up in five steps:
Create directories to host the content of a new virtual site.
Make a copy of the /etc/apache2/sites-available/defaults file with a site appropriate name.
Change the two /var/www/ entries to the actual directory of the new site.
Add the ServerName line with the real domain name you will be hosting.
Use a2ensite to enable the new site, and finally reload Apache2 so it knows about the new site
I tried all of this, but I can't get it to work. I didn't get any errors at any point during this process, but when I enter the address with the subdomain into my browser, I get a "Server not found" error.
The company that hosts my VPS has an admin page where I can set up subdomains. Stupid question: do I have to do reconfigure the DNS records or something while doing this, or is it likely that the problem is caused by something else?
Additional note: I followed a guide on howtoforge.com when setting up the server, which in hindsight may not have been the brightest move on my part. It is possible that I made a mistake there that is somehow affecting me now?
Assuming you've setup the subdomain correctly in your VPS' admin page, the only thing left to check here is that you've actually created the subdomain in your DNS administration page (have you?). For example, I use afraid.org to manage my DNS records and to add a subdomain, it's essentially:
Type: A
Subdomain: sparky
Domain: example.com
Destination: 120.34.2.3 (this would be your VPS' IP address)
In general, you add a (sub)domain by:
sparky.example.com A 120.34.2.3
Please keep in mind that you want to add an A record (this is important!).