Why apache2 is rendering only index.html
up vote
0
down vote
favorite
I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.
ubuntu apache-httpd
add a comment |
up vote
0
down vote
favorite
I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.
ubuntu apache-httpd
Have a look at/etc/apache2/sites-enabled/000-default.conf
that will have an entryDocumentRoot
, that is where your files are being served from. Very likely:DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.
ubuntu apache-httpd
I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.
ubuntu apache-httpd
ubuntu apache-httpd
edited Nov 25 at 22:44
Rui F Ribeiro
38.3k1477127
38.3k1477127
asked Apr 2 '16 at 3:51
Suba
1
1
Have a look at/etc/apache2/sites-enabled/000-default.conf
that will have an entryDocumentRoot
, that is where your files are being served from. Very likely:DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33
add a comment |
Have a look at/etc/apache2/sites-enabled/000-default.conf
that will have an entryDocumentRoot
, that is where your files are being served from. Very likely:DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33
Have a look at
/etc/apache2/sites-enabled/000-default.conf
that will have an entry DocumentRoot
, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33
Have a look at
/etc/apache2/sites-enabled/000-default.conf
that will have an entry DocumentRoot
, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available
. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost
or http://127.0.0.1
. You can have many different site configurations available, and activate only those that you need.
As an example, you want the default site to be /home/user/public_html/index.html
. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Copy the default website as a starting point:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf
Edit the new configuration file in a text editor sudo nano
on the command line or gksudo gedit
, for example:
gksudo gedit /etc/apache2/sites-available/mysite.conf
Change the DocumentRoot
to point to the new location. For example,
/home/user/public_html/
In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/>
to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite
(apache2enable site) and a2dissite
(apache2disable site).
sudo a2dissite 000-default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/index.html
, you will receive an warning message.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available
. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost
or http://127.0.0.1
. You can have many different site configurations available, and activate only those that you need.
As an example, you want the default site to be /home/user/public_html/index.html
. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Copy the default website as a starting point:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf
Edit the new configuration file in a text editor sudo nano
on the command line or gksudo gedit
, for example:
gksudo gedit /etc/apache2/sites-available/mysite.conf
Change the DocumentRoot
to point to the new location. For example,
/home/user/public_html/
In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/>
to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite
(apache2enable site) and a2dissite
(apache2disable site).
sudo a2dissite 000-default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/index.html
, you will receive an warning message.
add a comment |
up vote
0
down vote
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available
. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost
or http://127.0.0.1
. You can have many different site configurations available, and activate only those that you need.
As an example, you want the default site to be /home/user/public_html/index.html
. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Copy the default website as a starting point:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf
Edit the new configuration file in a text editor sudo nano
on the command line or gksudo gedit
, for example:
gksudo gedit /etc/apache2/sites-available/mysite.conf
Change the DocumentRoot
to point to the new location. For example,
/home/user/public_html/
In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/>
to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite
(apache2enable site) and a2dissite
(apache2disable site).
sudo a2dissite 000-default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/index.html
, you will receive an warning message.
add a comment |
up vote
0
down vote
up vote
0
down vote
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available
. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost
or http://127.0.0.1
. You can have many different site configurations available, and activate only those that you need.
As an example, you want the default site to be /home/user/public_html/index.html
. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Copy the default website as a starting point:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf
Edit the new configuration file in a text editor sudo nano
on the command line or gksudo gedit
, for example:
gksudo gedit /etc/apache2/sites-available/mysite.conf
Change the DocumentRoot
to point to the new location. For example,
/home/user/public_html/
In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/>
to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite
(apache2enable site) and a2dissite
(apache2disable site).
sudo a2dissite 000-default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/index.html
, you will receive an warning message.
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available
. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost
or http://127.0.0.1
. You can have many different site configurations available, and activate only those that you need.
As an example, you want the default site to be /home/user/public_html/index.html
. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Copy the default website as a starting point:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf
Edit the new configuration file in a text editor sudo nano
on the command line or gksudo gedit
, for example:
gksudo gedit /etc/apache2/sites-available/mysite.conf
Change the DocumentRoot
to point to the new location. For example,
/home/user/public_html/
In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/>
to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite
(apache2enable site) and a2dissite
(apache2disable site).
sudo a2dissite 000-default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/index.html
, you will receive an warning message.
edited Apr 5 '16 at 14:50
Evgeny Lebedev
13515
13515
answered Apr 2 '16 at 9:12
A Yashpal
765
765
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f273778%2fwhy-apache2-is-rendering-only-index-html%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have a look at
/etc/apache2/sites-enabled/000-default.conf
that will have an entryDocumentRoot
, that is where your files are being served from. Very likely:DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33