My friend introduce me Linode and register.com, so I am playing with it now. I already get a domain name, while on my Linode server I am trying to set up a basic webpage so I can start to use it for my personal website. I'm following http://library.linode.com/hosting-website#sph_web-server to set up.
Here's the question, I made a testsite folder on my linode server, and a /etc/apache2/sites-available/testsite file which can be called at sudo a2ensite testsite command. (All of these are part of the tutorial.) But when I wish to switch the content for that website, I created a testsite1 and a /etc/apache2/sites-available/testsite1, then I do sudo a2ensite testsite1, but I don't know how to let the apache read the content from my testsite1 folder instead of testsite folder. The way I did that is I try sudo a2dissite testsite, so then the content in testsite1 can be read. But I hope there is better way to do that. Also I've heard apache2 can handle multiple server at the same time. How to assign which server load which folder on my linux machine? (For example, if I have abc.net and efg.net, I already link both of them to my linode server, how can I let abc.net go to read the abc folder in my linux server, while the efg.net load my efg folder?) Thanks.
You need to edit the httpd.conf file usually found in /etc/apache2/conf. Then edit the httpd.conf file and look for "Document Root" setting in this file. Change it to /etc/apache2/sites-available/testsite1 and then restart apache: /etc/init.d/apache2 restart
Related
I am using Apache 2.4 on Raspbian and I want to create a virtual host to serve files on my external hard drive on my website. I searched it on the internet and found many guides to make it but this seemed the simplest: http://www.thegeekstuff.com/2011/07/apache-virtual-host/
However, the files "httpd.conf" and "httpd-vhost.conf" which are mentioned in the guide do not exist in my system (I searched the whole system). Therefore I can't configure those files and hence, my virtual host. When I was searching the information about location of https.conf on the internet, I learnt that it does not exist anymore. However, I couldn't find the information about what to do in this situation.
I have been searching it online for hours but I couldn't find the answer. I do not know how to set up my virtual host. I would greatly appreciate your help.
Debian derivatives keep their config files in /etc/apache2/
To create a new virtual host, create a new config file in /etc/apache2/sites-available/. You can use 000-default.conf as a template (but you'll need to add ServerName directives as you'll be creating a specific default host rather than the fallback).
Then run a2ensite YOUR-CONFIG.conf to turn it on, and service apache2 restart to restart the HTTP server so it picks up the new configuration.
I have the following host file entries on Ubuntu 14 machine running apache
127.0.0.1 localhost
10.20.32.20 library.myDNSname.org
10.20.32.20 library-intra.myDNSname.org
10.20.32.20 mtf
And also
sudo a2ensite library
sudo a2ensite mtf
sudo service apache2 restart
Now when I browse the site.. I can only access library.myDNSname.org page.
But When I
a2dissite library
I can access the mtf site.
Please note both site has been added to the sites-available.
Any Idea how I might run both site on the same server?
Thanks for input
I think it would have been more helpful if you had included your apache sites configuration and also how you are accessing your site (whether by ip or hostname).
If you are accessing your site by an ip then it will just select the default vhost which is the first vhost definition in the configuration file. For more info you can check out Apache's doc.
Please try to access the sites with hostnames and post errors in comments when you tried to access mtf site for the first time.
I've installed Ubuntu on a Oracle VM Virtual box, and installed Apache etc.
How do I change the var/www folder that Apache uses, to something else? Can I simply rename it? I'm, trying to change it to nordy/core, in place of var/www.
Can I create a separate folder called nordy/core and place my html files there? One of the reasons I did not do this it because I noticed that var/ has several other folders that will not be created if I simply create a new folder. So, I'm guessing the site wont work.
I'd like to store my html and php files in a folder nordy/core so Apache can use it from there. Can I simply create a folder nordy/core and point Apache to it in Apache's configuration?
How do I do this?
You need to change the value of the DocumentRoot directive of your apache2.conf file. You may find this file at /etc/apache2/apache2.conf.
DocumentRoot "/nordy/core"
Then restart your apache process.
sudo service apache2 restart
Maybe it is not a right channel to ask this question but I donot know where to ask.
I want to know how to run html file with apache on my ubuntu. I have written program with javascript and a html file and I want to run it via apache. I could not find htdocs folder in to copy my files there beside that I do not have permission to do that in ubuntu. My apache is installed in /usr/share/apache2.
When I write http://localhost it says:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
but I do not know where to add the contents.
any help.
The default folder that it serves the HTML files from is /var/www.
For example, /var/www/test.html would be http://localhost/test.html.
In my case where I have installed and running the Apache 2 and if I type localhost/ into the browser it opens the Apache 2 Ubuntu default Page.
Now what I did was:
Suppose your HTML webpage Demo.html is located in the Website directory then copy the HTML page using one of the commands:
:~$ cp ~/Website/Demo.html /var/www/html
If this command does not work then try with the following command:
:~$ sudo cp ~/Website/Demo.html /var/www/html
And then open your browser and type this the browser search bar:
localhost/Demo.html
It will open the copied Demo.html.
Also if you want to access this hosted webpage from the outside of the machine where Apache 2 is running then use it's external IP address instead of localhost as follows:
ExternalIP/Demo.html
I am attempting to edit the "default" file located at ..
"/etc/apache2/sites-available/default"
on my Ubuntu machine running Apache 2.2.8.
I want to do this in order to enable the use of .htaccess files. I have downloaded the "default" file and edited it and now I am trying to upload it back to the server via SFTP. I keep getting permission denied errors.
Could it be because Apache is running and making use of the file? I am an admin on the machine so I would expect to be able to overwrite the file. Thanks for any assistance.
No it does not need to be stopped.
Try accessing the file through ssh, and make sure you access it with root privileges:
sudo nano /etc/apache2/sites-available/default
You would still need to force-reload Apache after changing the config files, as tux21b suggested in a comment below:
sudo /etc/init.d/apache2 force-reload
For Apache/2.4.7 , the file that you want to edit is:
/etc/apache2/apache2.conf