###dnfのインストール
# yum install wget epel-release
# yum install dnf
###アップデート
# dnf update
# systemctl reboot -i
###vimのインストール
# dnf install vim
###unzipのインストール
# dnf install unzip
###Apacheのインストール
# dnf install https://centos7.iuscommunity.org/ius-release.rpm
# dnf install --enablerepo=ius httpd24u httpd24u-devel httpd24u-mod_ssl
# dnf install --enablerepo=epel nghttp2
# systemctl enable httpd
# systemctl start httpd
/etc/httpd/conf.d/ssl.conf
<VirtualHost _default_:443>
+<IfModule http2_module>
+ ProtocolsHonorOrder On
+ Protocols h2 http/1.1
+</IfModule>
/etc/httpd/conf.modules.d/00-mpm.conf
-LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
+#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
-#LoadModule mpm_event_module modules/mod_mpm_event.so
+LoadModule mpm_event_module modules/mod_mpm_event.so
# systemctl restart httpd
その他:参考
###PHPのインストール
# dnf install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# dnf install --enablerepo=remi-php73 php php-mysqli php-mbstring php-pear php-pecl-zip php-fpm
# systemctl enable php-fpm
# systemctl start php-fpm
###MariaDBのインストール
/etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# dnf install mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
# mysql_secure_installation
# setsebool -P httpd_can_network_connect=1
###phpMyAdminのインストール
# cd /var/www/html/
# wget https://files.phpmyadmin.net/phpMyAdmin/4.8.4/phpMyAdmin-4.8.4-all-languages.zip
# unzip phpMyAdmin-4.8.4-all-languages.zip
# phpMyAdmin-4.8.4-all-languages mysqlad
###firewallの設定
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload
###動作確認
https://server_id_addr/mysqlad/
でphpMyAdminの接続とhttp/2.0の有効化をHTTP/2 Indicatorにて確認
HTTP/2 Indicator
HTTP/2 and SPDY indicator
LAMPの設定はここまで
###semanageのインストール
#dnf install policycoreutils-python
###Apacheで利用可能なselinuxコンテキスト登録済なポートを確認
#semanage port -l | grep http
http_cache_port_t tcp 8080, 8118, 8123, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
###Apacheの使用ポートを変更
/etc/httpd/conf/httpd.conf
-Listen 80
+Listen 81
/etc/httpd/conf.d/ssl.conf
-Listen 443 https
+Listen 8443 https
-<VirtualHost _default_:443>
+<VirtualHost _default_:8443>
###Nginxのインストール
/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
# dnf install nginx
# systemctl enable nginx
# systemctl start nginx
# mkdir -p /etc/pki/nginx/private/
# cp /etc/pki/tls/certs/localhost.crt /etc/pki/nginx/localhost.crt
# cp /etc/pki/tls/private/localhost.key /etc/pki/nginx/private/localhost.key
/etc/nginx/conf.d/ssl.conf
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name _;
root /usr/share/nginx/html;
index index.html index.htm index.php;
ssl_certificate "/etc/pki/nginx/localhost.crt";
ssl_certificate_key "/etc/pki/nginx/private/localhost.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
###Node.jsのインストール
# dnf install --enablerepo=epel npm
# npm install -g n
# n latest
# npm install -g yarn