Changing hostname of VPS - ZPanel Issue - apache

Basically I've got a VPS setup but I incorrectly set the hostname. I left it for a while and it was fine, installed zpanel etc and now it's a 'web host' and everything was fine. Now I want to change the hostname so I logged into the hosting companies control panel for the server and changed the hostname.
The original and the new hostname are in the format of xxx.yyy.com. So nothing happend and I could still reach the zpanel login page via the 'old' host name even though in the hosting companies control panel it said it had changed.
For ease of explanation, we shall say my old hostname was xyz.example-domain.com and my new is server.another-domain.com. Both domains are controlled within this installation of zpanel.
Anyway. I deleted the dns entry for "xyz" on example-domain and, as you would expect, if you go to xyz.example-domain.com you get nothing. I created a dns A record for server.another-domain.com but now all you get is the default apache 'welcome to your server' page. To get to zpanel login, you need the IP address.
SO my question is, do I need to do something else? It seems that I need to change where this zpanel login page is getting displayed so that it can be server.another-domain.com. I'm guessing there is some file somewhere that I need to edit but I don't know what one and "the internet" isn't really helping as all I find is 'change the host name in the hosting companies control panel' which I've done.
PS It is an apache 2 server running CentOS 6

Take a look at your Apache configuration located in /etc/httpd/conf/httpd.conf. If you intend on running multiple domains off the same host, you'll need to setup Virtual Hosts. You'll see a detailed explanation of those settings toward the bottom of your configuration file.
Depending on where you've located your files, you'll want to set your DocumentRoot accordingly for each of your Virtual Hosts, and that will instruct Apache to look for the files in the proper places. By default, I believe it looks in /var/www.
NOTE: You will need to restart Apache or reload configurations whenever you alter your configuration file. You can do this by running either one of the following commands (as root):
/etc/init.d/httpd restart
/etc/init.d/httpd reload

Go to /etc/zpanel/panel/
rename: index.php -->panel.php (or any other name).
Then create index.php and let it in blank (or write a welcome message)
Finally enter to your zpanel like this: http://www.yourIP/panel.php
Works fine!
Is not necessary change any port

Related

How to change apache2 127.0.0.1 name from localhost to another domain?

Sorry if this question is stupid, but I am a newbie when it comes to apache and servers in general and I have been trying but I can only find windows only answers. I'm running an apache server on a mint vm. When I type localhost, it redirects to the page automatically, same as doing 127.0.0.1 or 127.0.1.1. Now, I want to change this to another domain name, but not a website one. Like, I want to change from the word localhost to another word, like 'local'. I have been unable to find answers, I have read about virtual hosts but I don't think that is it because I'm only running one website instance. This is just an example website btw, it's just a index.html file for me to learn how to configure things. I have changed my 000-default.conf to say ServerName thenameIwant but it doesn't work. I noticed it says that this is the last resort host what is the first one?
To be able to use local to connect to your server, you would use local as a domainname which resolves to localhost or 127.0.0.1. You could do this by editing your hosts file. Depending on your os this file is stored in different places. Just google 'Change hosts file [your os]'. And add the following line: local 127.0.0.1.
The default apache server is set to listen for any domain, also local.

Host multiple domains with apache

I'm trying to set up an ubuntu server to act as a dns server and host a simple webpage, some git repos, and some software for issue tracking, code review, and the like. I settled on Phabricator as the issue tracking/ code review software of choice, since it seemed to be a good all-in-one solution. I've got my server hosting my webpage and git repos, so that part seems to be working ok. Now here's the issue I've run into (from Phabricator configuration instructions):
If you haven't already, set up a domain name to point to the host you're installing on. You can either install Phabricator on a subdomain (like phabricator.example.com) or an entire domain, but you can not install it in some subdirectory of an existing website
I have no idea where to even begin setting up another domain name on my server. How do I set up a second domain name for Phabricator to use?
I see a lot of guides online that say to modify resolv.conf to add a dns entry, however mine looks like this:
Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
and I'm not sure what I should change to get dns entries to show up here.
I'm assuming you have only one IP address, which means you should be using virtual name-based hosting. There are a number of tutorials for doing this, but in short:
Create a virtual host configuration file in:
/etc/apache2/sites-available
For example:
nano /etc/apache2/sites-available/phabricator
Run:
a2ensite phabricator (in this example, but use the configuration file name you used above)
apache2ctl restart
The configuration file (which can be named whatever you'd like) needs to contain a number of items. A simple example would look like this:
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com
</VirtualHost>
DocumentRoot is the full path to the root of your site, usually where index.html, index.php, or the like is located. The default is /var/www. You could put somethig like /home/phabricator or /var/www/phabricator, but make sure you install Phabricator in the directory you specify.
ServerName is the full FQDN of your site, such as "www.google.com" or "phabricator.yourdomain.com" or even "phabricator.local". Basically it's the same value as you have set in your DNS for your A record, or in your /etc/hosts file. If you don't know about /etc/hosts, then disregard that part.
You'll probably need a few more directives in your configuration file, but you can find what's available on Google. I would suggest following some tutorials to get your configuraiton right.
But overall, you just need to create a virtual host config file, enable it, then restart the server, which is what the above instructions do. Apache will respond to the web request based on the site you put into your address bar.
P.S. Just noticed your DNS part of the question. Do you have DNS set up publicly to point a domain (example.com) or subdomain (something.example.com) to your server's IP address?

Apache does not start - httpd.conf in windows

I am trying to set up Apache http 2.2, with mod_jk module.
The intention is to set up a load balancer right on my PC, for test purposes.
So I made some changes to httpd.conf to set some parameters, then I run it and I get the popup:
"Windows couldn't start Apache 2.2 on local PC. For more information check system events log. If it's not a windows service contact service provider and reference the code:1"
I check on the log and I get:
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.0.35 for ServerName
So I uncomment on httpd.conf line: ServerName myPcName:80 and run it again.
I get the same popup, but this time I don't get anything on the events log.
Any idea on how to let it work?
(Nothing is bound on 80 port.)
Thank you
Please check if port 80 is being used by other application or not. Most of the time in my case "Skype" was using port 80. So I had to stop it and then I used to start Apache service.
To troubleshoot further what you can do is, goto apache's bin directory and run httpd.exe -t option. This will show you exactly what is causing problem.
The configuration file in the apache /conf folder, has a piece of code that starts from C:. It is copyrighted and therefore you cannot change the code.
All you have to do is make a second copy of the whole apache folder and put it directly in your C: directory. Your apache file is in System 32 causing you to use cprompt right. Having 2 identical apache folders one in C: and one in System 32 bypasses the problem.

Home apache web server - final hurdle

Ok, so bit of noob question - having one of those days.
I have set up a home apache web server on Ubuntu. I have configured vhosts as I want to host multiple websites. These work fine in the local browser, e.g.
http://site1
http://site2
both display their various contents.
For the server side of things, I've configured port forwarding on my router to send all port 80 requests to the server IP.
When I go to an external browser and type in my servers external IP address I get the standard apache "It works!" message. When I type in ipaddress/site1 I get 404. The site1 is not in the standard apache default directory, I have it in home/username/Sites/site1 folder and httpd.conf file knows this.
How is it I can access these site1 and site2 sites externally?
Cheers
Just as you would do in your local browser. So typing in http://site1 would lead you to the first site. This is based on an assumption though, which is that you put the http://site1 address in your /etc/hosts file. When your computer looks up an URL, it first checks the hosts file (and your case will find the correct IP address there) and next will ask a global mechanism for the address.
The reason why it doesnt find anything at "ipaddress/site1" is because of the vhosts configuration. This teel Apache serve the content of a folder somewhere on your server as a separate hostname, e.g. http://site1. If you're requesting "ipadress/site1", you're actually telling Apache to look in the folder "site1" in its first root it encounters in your Vhost configuration.

Hosting not loading pages

i am new to web hosting, but i purchased a domain from namecheap.com and i purchased web hosting from ramnode.com to host my domain, i am using centOS 32bit as my server, and i have pointed my domain to ramnode nameservers that were provided to me.
The problem i am having here is that everytime i load my website, it just says
Index Of/
cgi-bin/
even though i have placed my web page files in var/www, and var/www/html like ramnode support told me too, it still does not want to work. Any suggestions?
It all depends on how your server is setup but here are a few things to check.
What are the permission levels for your files, who owns them and what group are they in? If you don't have proper permissions set they may not show. If the wrong person owns them they may not show.
Read over your httpd.conf (centos should have it in /etc/httpd/conf) see how your server is setup. It may not have a default setup, perhaps your using a virtual host?
In a nutshell we need more information to help you out.
You should have an
.htaccess or htaccess.txt file in your WWW root, whithin that file you need the following line:
DirectoryIndex index.htm index.html index.php
That is the priority order of your index page. (Your web project needs an index page)
So in otherwords your webserver will serve the first matching file that it finds in that list.
A quick fix if you cant find the htaccess file, is just make sure you have an index.html file in your var/www
I just reset my nameservers to point to ramnode's last night and am experiencing the same issue as the OP this morning.
I previously had no FQDN for the ramnode server and simply used my /etc/hosts file locally to point to the ramnode server. Through that method, I was able to make sure everything was setup just so - apache virtualhosts, .htaccess files, apache.conf, and httpd.conf files all operating as desired.
It seems to have something to do with the installation of the cpanel, which auto-fills DNS A records with a different IP than the one I was provided. changing it to ramnode's original IP simply leads to the same cgi-bin directory index. But going going to the original ip in the browser leads to my site, as I have the apache virtualhost set for the IP.
Ramnode sets subdomain a records such as cpanel.mydomain.com all set to the same new IP and those do function, so it leads me to believe a ramnode server is capturing the trafic elsewhere and should be sending it on but isn't.
It's a bit confusing where cpanel is taking me and why redirecting to my the domain.com. A record to the original IP seems to have no effect.