https://lamp.sh/install.html安装环境
Apache 命令
/etc/init.d/httpd (start|stop|restart|status)
Apache开启日志
CustomLog "/usr/local/apache/logs/web.log" combined
配置SSL,
阿里云申请证书
在vhost添加配置
<VirtualHost _default_:443>
DocumentRoot /www
ServerName xxx
SSLEngine on
SSLCertificateFile /cert/xxxx_public.crt
SSLCertificateKeyFile /cert/xxx.key
SSLCertificateChainFile /cert/xxx_chain.crt
<Directory /data/www/default/web>
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Order Deny,Allow
Allow from All
DirectoryIndex index.php index.html index.htm
</Directory>
CustomLog "/www.log" combined
</VirtualHost>
重定向文件.htaccess强制转https
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.xxxx.com [NC]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
服务器内存1安装php7.3内存不足,扩展安装不上,阿里云ECS配置swap分区
检查分区情况
free -m
增加分区,1024000为大小1G
dd if=/dev/zero of=/home/swap bs=1M count=1024
做成分区
mkswap /home/swap
启动交换分区
swapon /home/swap
看一下是否启动
free -m
引导式启用,写入文件
echo "/data/swap swap swap defaults 0 0" >> /etc/fstab
查看
free -m
完成
mysql忘记密码设置
vi /etc/my.cnf
在mysql.sock后面一行添加skip-grant-tables
保存重启数据库
mysql -u root -p
进入后修改密码
use mysql
update mysql.user set authentication_string=password('root_password') where user='root';
nginx命令不存在
编辑
vim /etc/profile
最后添加
PATH=$PATH:/home/nginx/nginx/sbin #nginx启动文件路径
export PATH
保存
source /etc/profile
添加多个
PATH=$PATH:/home/nginx/nginx/sbin:/home/nginx/nginx/sbin