系统信息
apache安装:
yum install httpd -y
nginx安装:(源码安装:https://blog.csdn.net/w50feng/article/details/106048878)
yum install nginx -y
php安装:
安装epel库:yum install epel-release -y
安装webtatic库:rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
查询php版本:yum search php
下载php7.1:yum install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath php71w-pecl-redis -y
mysql安装:
yum install -y wget
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm -y
yum install mysql-community-server -y
启动mysql:systemctl start mysqld
第一次登陆密码在日志文件查找:vim /var/log/mysqld.log
使用查询到的密码登陆数据库:mysql -uroot -p
修改root密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abc123!@#';(密码太简单报错1819)
验证LAMP:
vim /var/www/html/phpinfo.php
<?php phpinfo(); ?>
启动http:systemctl start httpd
浏览器访问:serverip/phpinfo.php(如果无法访问,检查防火墙端口是否放行)
验证LNMP:
启动php-fpm:systemctl restart php-fpm
配置nginx:vim /etc/nginx/nginx.conf
server {
listen 81 default_server;
listen [::]:81 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
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;
}
}
配置端口为81,80上面httpd已经使用了,增加匹配php的location
编辑测试文件:vim /usr/share/nginx/html/phpinfo.php
<?php phpinfo(); ?>
启动nginx:systemctl start nginx
浏览器访问:serverip:81/phpinfo.php
-----------日常记录---------------