Apache from scratch on Centos 7

Dec 23, 11:56 AM

NOTE: on google-cloud, dont forget to set firewall rules!

sudo yum —assumeyes update;
sudo yum —assumeyes install httpd;

sudo systemctl start httpd ;
sudo systemctl enable httpd ;
sudo systemctl status httpd ;

vi /etc/httpd/conf/httpd.conf ;
Find the section and change AllowOverride None to AllowOverride All

AllowOverride All

and add this line:

LoadModule rewrite_module modules/mod_rewrite.so

and finally:
sudo systemctl restart httpd ;

P H P — A P A C H E S T U F F :

yum —assumeyes install php-pdo ;
yum —assumeyes install php-pdo_mysql ;

service httpd restart ;

  1. had to do the following on 123systems.net:

yum —assumeyes install firewalld ;
systemctl unmask firewalld ;
systemctl enable firewalld ;
systemctl start firewalld ;
firewall-cmd —permanent —add-port=80/tcp ;
firewall-cmd —get-active-zones ;
firewall-cmd —zone=dmz —add-port=80/tcp —permanent ;
firewall-cmd —get-active-zones ;
firewall-cmd —reload ; ### do NOT forget this step !

  1. OPTIONAL OPTIONAL – otherwise you can see the “default” apache page
    cat </var/www/html/index.html ;
    this is a test to see if apache is indeed working
    END

now try the IP ## in your browser.

cat </var/www/html/phpinfo.php;

END

  1. INSTALL PHP:

yum —assumeyes install php php-pear php-mysql ; ## current default centos version, might be old
systemctl restart httpd.service ; ## dont skip this step (again)!

Mark Edwards

,

---

Commenting is closed for this article.

---