Live Chat
True
FAQs
Development

How To Install the Apache Web Server on CentOS 7?

sudo yum update


#install nano editor if not exist

sudo yum install nano


#install apache2(httpd) if not exist

sudo yum install httpd


sudo systemctl start httpd


sudo systemctl enable httpd


#the following steps to setup you domain with odoo( don't forget to replace your_domain  by your real domain name like erpzero.com


sudo mkdir -p /var/www/your_domain/html

sudo mkdir -p /var/www/your_domain/log

sudo chown -R $USER:$USER /var/www/your_domain/html

sudo chmod -R 755 /var/www


#create a sample index.html

sudo nano /var/www/your_domain/html/index.html


<html>

    <head>

        <title>Welcome to your_domain!</title>

    </head>

    <body>

        <h1>Success!  The your_domain virtual host is working!</h1>

    </body>

</html>



#Create both directories (sites-available  and sites-enabled)


sudo mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled


sudo nano /etc/httpd/conf/httpd.conf


IncludeOptional sites-enabled/*.conf


sudo nano /etc/httpd/sites-available/your_domain.conf


#Add in the following configuration block, and change the your_domain


<VirtualHost *:80>

    ServerName www.your_domain

    ServerAlias your_domain

    DocumentRoot /var/www/your_domain/html

    ErrorLog /var/www/your_domain/log/error.log

    CustomLog /var/www/your_domain/log/requests.log combined

LimitRequestLine 10000000000

LimitRequestBody 10000000000

LimitRequestFieldSize 10000000000

ProxyPreserveHost On

ProxyPass / http://localhost:8069/ retry=0

ProxyPassReverse / http://localhost:80169/

</VirtualHost>


#create a symbolic link for each virtual host in the sites-enabled directory


sudo ln -s /etc/httpd/sites-available/your_domain.conf /etc/httpd/sites-enabled/your_domain.conf


#Adjusting Apache Policies Universally

sudo setsebool -P httpd_unified 1


#Adjusting Apache Policies on a Directory


sudo ls -dZ /var/www/your_domain/log/


#cahnge the context type from httpd_sys_content_t  to httpd_log_t for your domain


sudo restorecon -R -v /var/www/your_domain/log


#test the virtual host


sudo systemctl restart httpd


#after save the laste file run the foloowing


sudo systemctl restart httpd


# add domain to hosts and save file

nano /etc/hosts

127.0.0.1  your_domain


# to reload centos 7 hosts

/bin/systemctl restart systemd-hostnamed

#install ssl for your domain 

sudo yum install python-certbot-apache -y


sudo certbot --apache -d your_domain


# if firewall installed 

sudo firewall-cmd ––permanent ––add-port=80/tcp

sudo firewall-cmd ––permanent ––add-port=443/tcp

sudo firewall-cmd ––reload



Was this article helpful?

FAQ HOME

To install this Web App in your iPhone/iPad press and then Add to Home Screen.