在开发环境的虚拟机中安装CentOS7.
安装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
<VirtualHost _default_:443>
+<IfModule http2_module>
+ ProtocolsHonorOrder On
+ Protocols h2 http/1.1
+</IfModule>
-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
[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-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指示器
HTTP/2和SPDY指示器
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的使用端口更改
-Listen 80
+Listen 81
-Listen 443 https
+Listen 8443 https
-<VirtualHost _default_:443>
+<VirtualHost _default_:8443>
安装Nginx
[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
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