Page 1 of 1

Created a wildcard for domain name, and they point to wrong domain name.

Posted: Wed Jan 04, 2017 4:47 pm
by AFN
I am a bit frustrated because it seems no matter what I'm doing nothing is working except for pointing any subdomain names to the wrong domain name.

I have successfully installed milliscripts.at, a website that allows anyone to run their own version of cc.co where you can point sub-domain names to other websites, or pages if you chose.

I got everything to work perfectly except for the subdomain name part. Here's what I did:

I logged into VestaCP > DNS > clicked on the domain name that I wish to use > clicked on the green plus sign to add a DNS record > entered a star “*” for making a wildcard, picked “A” from the drop down menu > entered my server's IP > press save. I wait a few seconds witch the changes take effect with a matter of seconds.

Now here is the problem that I'm facing, whenever I enter any subdomain name it redirects me to another website.

This website that I am being redirected to is my main website if you want to call it that, whenever you enter my service’s IP, the IP will redirect to the domain name.

I have looked through the form and also through the help pages and I cannot figure out what am I doing wrong.

Re: Created a wildcard for domain name, and they point to wrong domain name.

Posted: Tue Jan 10, 2017 2:49 pm
by SS88
It sounds like you have the DNS set up correctly however, you also need NGINX and/or Apache to be set up to accept a wildcard domain too.

By default, nginx / apache in VestaCP have a wildcard domain and that's the default server hostname one under the admin account, and it always (or usually does) comes first in the includes.

You will need to modify the config in order to accept a wildcard subdomain. An example in nginx is:

Code: Select all

server {
  listen 80;
  server_name *.example.com;
  root /www/pub/;
}
The any request for lala.example.com or wewe.example.com will load the files in /www/pub/

Re: Created a wildcard for domain name, and they point to wrong domain name.

Posted: Thu Jan 12, 2017 3:16 am
by AFN
Where do I find this config file that I need to modify and do I copy the code that you posted above into the config file?

Re: Created a wildcard for domain name, and they point to wrong domain name.

Posted: Thu Jan 12, 2017 3:54 pm
by SS88
What set-up do you use? nginx and php-fpm? Or nginx and apache?

Re: Created a wildcard for domain name, and they point to wrong domain name.

Posted: Thu Jan 12, 2017 8:01 pm
by AFN
CentOS 6.6

When I access a domain name on my VPS and the error page says "Forbidden" it says Apache/2.2.15 (CentOS) Server, so I think it is that, however when I log into VCP > Server > configure > web > nginx. So I am not sure. I've uploaded a php info file at https://vps1.wqyu.com/phpinfo.

Re: Created a wildcard for domain name, and they point to wrong domain name.

Posted: Wed Jan 18, 2017 8:32 pm
by AFN
SS88 wrote:What set-up do you use? nginx and php-fpm? Or nginx and apache?
I do believe that my setup is nginx and apache. I managed to find the files that I think I need to make the edits which they are located in /home/admin/conf/web and the name of them are nginx.conf and httpd.conf which when I make the edits it then works when I use the php script.

I installed the script on afn.me however when I try to add a new sub-domain name for wqyu.com for example in the control panel it then gives me an error saying httpd cannot be started witch then taken down all of the websites that are hosted on the server.

A temporary fix which I don't think I should have to do this, perhaps I may be wrong. I have to login to the server download those two files to reverse this small change I made by restoring the three W and then re-upload them to the server if the httpd has stopped, then restart httpd backup and then add the sub-domain name > then download the same files to add the wild card and re-upload.

Re: Created a wildcard for domain name, and they point to wrong domain name.

Posted: Thu Jan 19, 2017 1:19 pm
by SS88
Whenever you make changes to a users nginx/apache conf file if you do anything in vesta that rewrites these files they will be overwritten.

I just checked my development server and I added:

domain.com
Alias = *.domain.com

Create it, and it works. I do not use Apache so you would have to test this.

*.wqyu.com would match any sub domain unless you specifically specify them in the DNS.

Re: Created a wildcard for domain name, and they point to wrong domain name.

Posted: Thu Feb 02, 2017 6:20 pm
by AFN
This issue is not solved, I'm suspecting there is an issue.

When I implement the wildcard on domain name i.e. afn.me, if I add or remove a sub-domain name on another domain name like wqyu.com for example, it takes the whole server down instead of just overwriting the conf file. If I do not remove the wildcard from the domain name and restore the three W’s “www”, when trying to add or remove a sub-domain name on another domain name like wqyu.com, it gvies me some error about httpd cannot be started, then httpd will not start until I restore the three W’s, is this normal? I mean I shouldn't have to do this every single time as I said above (see here viewtopic.php?f=13&t=13541#p55549) if I wish to add or remove a sub-domain name on a different domain name.