Simple steps:
- Install the Apache2
- Place your files under any folder in the server
- Configure Apache2 000-default.conf file to point the file directory
- Restart the Apache2 service
- Just view the hosted domain in web browser.
Yes, the steps says it is easy all you have to work on one file to configure ie., Configure Apache2 000-default.conf file to point to the file directory.
File path installation may vary based on the operating system you selected to host
Step1:
sudo apt-get install apache2
Step2:
Place you files in any folder and copy the path.
In this instance let me place the files under /var/www/xyx.com
Step3:
Just make the 4 lines changes
ServerAdmin webmaster@localhost # set the email for any mails from server fails
DocumentRoot /var/www/xyx.com #set the document path
RedirectMatch 301 (.*) http://www.xyz.com$1 #redirect the url permanently set this
and
<Directory /var/www/>
here /var/www is base directory under where your web-host code directory present
sudo vi /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request’s Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName http://www.example.comServerAdmin webmaster@localhost # set the email for any mails from server fails
DocumentRoot /var/www/xyx.com #set the document path
RedirectMatch 301 (.*) https://www.xyz.com$1 #redirect the url permanently set this# Available loglevels: trace8, …, trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warnErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory># For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with “a2disconf”.
#Include conf-available/serve-cgi-bin.conf
</VirtualHost># vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Step4: Restart the apache2
sudo service apache2 restart
Step 5:
Use your domain in the any client or browser.
you are done with your web hosting !!
Thanks for visiting Techie hints