Linux CentOS 7 jako webserver - Apache, Nginx, PHP, MariaDB (MySQL), PostgreSQL
Další velmi strohý návod pro zprovoznění webserveru na CentOS 7 - instneme a rozjedeme si balíčky Apache, Nginx, PHP 5 (PHP 7), databázi MariaDB (MySQL) a PostgreSQL. Neopomeneme ani phpMyAdminem, ani phpPgAdmine, ba ani virtualhosty...
-
-
-
APACHE (či NGINX)
VIRTUALHOST
PHP 5
PHP 7.1
PHP 7.2
MariaDB (či MySQL)
PostgreSQL
-
-
-
APACHE (či NGINX)
yum install epel-release httpd
(yum install nginx)systemctl start httpd.service
(systemctl start nginx)systemctl enable httpd.service
(systemctl enable nginx)firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
VIRTUALHOST
mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled
vim /etc/httpd/conf/httpd.conf
#Přidat řádek
IncludeOptional sites-enabled/*.confvim /etc/httpd/sites-available/cloud.up4.cz.conf
#Vhost cloud.up4.cz na portu 88
<VirtualHost *:88>
ServerName cloud.up4.cz
ServerAlias cloud.up4.cz
DocumentRoot /var/www/cloud.up4.cz/www
ErrorLog /var/www/cloud.up4.cz/error.log
CustomLog /var/www/cloud.up4.cz/requests.log combined
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
+ přidat do httpd.conf Listen 88
+ povolit port 88 ve firewalld
PHP 5
yum install php php-pear php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
systemctl restart httpd.service
PHP 7.1
yum install centos-release-scl-rh
yum install rh-php71-php
rh-php71-php-json rh-php71-php-mysqlnd rh-php71-php-mbstring rh-php71-php-cli rh-php71-php-pdoyum search rh-php71u
#zbytek balíčků rh-php71 dle uváženísystemctl restart httpd.service
PHP 7.2
yum install yum-utils https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php72
yum install php72-php-*
php72-php-pgsql php72-php php72-php-phpiredis php72-php-process php72-php-pspell php72-php-recode php72-php-smbclient php72-php-snappy php72-php-snmp php72-php-snuffleupagus php72-php-soap php72-php-sodium php72-php-tidy php72-php-twig php72-php-wkhtmltox php72-php-xml php72-php-xmlrpc php72-php-zephir-parser php72-php-zstd php72-uwsgi-plugin-php php72-zephir php72-zephir-parser php72-runtime php72-scldevel php72 php72-build php72-php php72-php-ast php72-php-bcmath php72-php-cli php72-php-common php72-php-componere php72-php-dba php72-php-dbg php72-php-devel php72-php-embedded php72-php-enchant php72-php-fpm php72-php-gd php72-php-geos php72-php-intl php72-php-ioncube-loader php72-php-json php72-php-lz4 php72-php-mbstring php72-php-mysqlnd php72-php-oci8 php72-php-odbc php72-php-opcache php72-php-pdo php72-php-pdo-dblib php72-php-pear
MariaDB (či MySQL)
yum install mariadb-server mariadb phpMyAdmin
(yum install mysql-server)systemctl start mariadb.service
(systemctl start mysqld)systemctl enable mariadb.service
(systemctl enable mysqld)mysql_secure_installation
#nastavení symlinku pro přístup localhost/phpmyadminln -s /usr/share/phpMyAdmin/ /var/www/html/phpmyadmin
#povolení mysql ve firewalldfirewall-cmd --permanent --zone=public --add-service=mysql
firewall-cmd --reload
PostgreSQL
yum install postgresql-server postgresql-contrib phpPgAdmin php-pgsql
postgresql-setup initdb
vim /var/lib/pgsql/data/pg_hba.conf
....
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
....systemctl start postgresql
systemctl enable postgresql
#nastavení symlinku pro přístup localhost/phppgadminln -s /usr/share/phpPgAdmin /var/www/html/phppgadmin
#povolení PostgreSQL ve firewalldfirewall-cmd --permanent --zone=public --add-port=5432/tcp
firewall-cmd --reload