分类 计算机类 下的文章

使用lnmp安装后后台登录不进去,花费3个月重装VPS,重装LNMP
还是发现PHPinfo和伪静态问题导致无法打开后台,重新折腾了一下
自己手动安装了 nginx / php /mysql
最后终于折腾完成了

1.系统

debian 11
更新源
/etc/apt/sources.list

 # comment out DVD source and add network source
 #deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main deb
 http://deb.debian.org/debian/ bullseye main contrib
 # if comment outed
 # uncomment it to enable [security] source deb http://security.debian.org/debian-security bullseye-security main
 contrib
 # if comment outed
 # uncomment it to enable [updates] source deb http://deb.debian.org/debian/ bullseye-updates main contrib
 
 deb http://deb.debian.org/debian/ bullseye-backports main contrib

最后可使用官方源,可以不用更改

2.安装nginx

参考 https://www.insilen.com/post/linux-nginx-php.html

安装先决条件:

apt install curl gnupg2 ca-certificates lsb-release

要为稳定的 nginx 软件包设置 apt 仓库

echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" \
    | tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add -

不验证完整了

sudo apt update
sudo apt install nginx

加入开机

systemctl enable nginx

重新启动nginx

service restart nginx

3.防火墙放行

参考 https://sunpma.com/555.html
添加80和443端口,测试是否正常访问
Debian/Ubuntu 放行端口
安装iptables(通常系统都会自带,如果没有就需要安装)

apt-get update
apt-get install iptables

放行对应端口

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT

然后保存放行规则

iptables-save

设置完就已经放行了指定的端口,但重启后会失效,下面设置持续生效规则;
安装iptables-persistent

apt-get install iptables-persistent

保存规则持续生效

netfilter-persistent save
netfilter-persistent reload

设置完成后指定端口就会持续放行了;

Centos:

yum update
yum install iptables

放行端口

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent

命令含义:

--zone                      #作用域
--add-port=80/tcp  #添加端口,格式为:端口/通讯协议
--permanent           #永久生效,没有此参数重启后失效

然后重启防火墙

firewall-cmd --reload

查看防火墙规则

iptables -L

4.安装PHP

要安装 MySQL 对 PHP 7.4 的支持

sudo apt install -y php7.4-mysql

WordPress 的 PHP 扩展

apt install -y \
php7.4-mysql \
php7.4-dom \
php7.4-simplexml \
php7.4-ssh2 \
php7.4-xml \
php7.4-xmlreader \
php7.4-curl \
php7.4-exif \
php7.4-ftp \
php7.4-gd \
php7.4-iconv \
php7.4-imagick \
php7.4-json  \
php7.4-mbstring \
php7.4-posix \
php7.4-sockets \
php7.4-tokenizer

Typecho 的 PHP 扩展

apt install -y \
php7.4-xml \
php7.4-curl \
php7.4-mysql \
php7.4-mbstring

Joomla 的 PHP 扩展

apt install -y \
php7.4-mysql \
php7.4-xml \
php-pear \
php7.4-json

Drupal 的 PHP 扩展

apt install -y \
php7.4-mysql \
php7.4-dom \
php7.4-gd \
php7.4-json \
php7.4-pdo \
php7.4-simplexml \
php7.4-tokenizer \
php7.4-xml

5.安装mysql

从mysql官网找到debian的mysql安装包url

https://dev.mysql.com/downloads/repo/apt/

查看最新的版本

wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb

配置下载的包

sudo dpkg -i mysql-apt-config_0.8.22-1_all.deb

弹出mysql数据源配置的图形界面,选择ok 继续。
更新数据源

sudo apt-get update

安装更新包

sudo apt-get install mysql-server

正常的操作 配置root 密码 后测试出现mysql>即可

mysql -uroot -p

基本的mysql 操作

sudo service mysql start
sudo service mysql stop
sudo service mysql restart

删除mySQL 停用,查询包,删除文件

service mysql stop

rm -rf /var/lib/mysql
rm -rf /var/lib/mysql
rm -rf /usr/lib64/mysql

dpkg --get-selections | grep mysql

sudo apt-get --purge remove mysql-server
sudo apt-get --purge remove mysql-client
sudo apt-get --purge remove mysql-common

apt-get autoremove
apt-get autoclean

rm /etc/mysql/ -R
rm /var/lib/mysql/ -R

6.配置nginx,修改文件重定向
进入/etc/nginx
配置 nginx.conf
改成自己想要使用的方式
nginx/1.18.0
目录有变化
进入/etc/nginx/sites-available
后台404,参考官方更改 http://docs.typecho.org/servers#nginx
修改default文件,权限,安全,配置根据需要修改

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /www;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html index.php;

    server_name _;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;

                ##这里添加
                set $path_info "";
                set $real_script_name $fastcgi_script_name;
                if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                        set $real_script_name $1;
                        set $path_info $2;
                }
                fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
                fastcgi_param SCRIPT_NAME $real_script_name;
                fastcgi_param PATH_INFO $path_info;
                ##这里结束


    }

    # pass PHP scripts to FastCGI server
        ##这里修改
        location ~ .*\.php(\/.*)*$ {
        ##这里结束
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
            include         fastcgi_params;
            fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
        ##这里添加
            fastcgi_param   PATH_INFO            $path_info;
        ##这里结束
          }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny all;
    #}
}

弄完之后发现typecho竟然升级了....
最近版本 1.2.0赶紧升级上去!!

office-2013
https://support.microsoft.com/zh-cn/topic/office-2013-%E4%B8%AD%E7%9A%84%E6%96%B0%E5%A2%9E%E5%8A%9F%E8%83%BD-dcce97ca-fe5d-4295-a1c3-49da3e775856?ui=zh-cn&rs=zh-cn&ad=cn
office-2016
https://support.microsoft.com/zh-cn/office/office-2016-%E4%B8%AD%E9%9D%A2%E5%90%91%E9%9D%9E%E8%AE%A2%E9%98%85%E8%80%85%E7%9A%84%E6%96%B0%E5%A2%9E%E5%8A%9F%E8%83%BD%E5%92%8C%E6%94%B9%E8%BF%9B%E4%B9%8B%E5%A4%84-29d7e38e-ef06-4d9c-a476-03d896928b2f
office-2019
https://support.microsoft.com/zh-cn/office/office-2019-%E4%B8%AD%E7%9A%84%E6%96%B0%E5%A2%9E%E5%8A%9F%E8%83%BD-5077cbbe-0d94-44cc-b30e-654e37629b0c
office-2021
https://support.microsoft.com/zh-cn/office/office-2021-%E4%B8%AD%E7%9A%84%E6%96%B0%E5%A2%9E%E5%8A%9F%E8%83%BD-43848c29-665d-4b1b-bc12-acd2bfb3910a
outlook-for-microsoft-365
https://support.microsoft.com/zh-cn/office/outlook-for-microsoft-365-%E4%B8%AD%E7%9A%84%E6%96%B0%E5%A2%9E%E5%8A%9F%E8%83%BD-51c81e7a-de25-4a34-a7fe-bd79f8e48647

office-快速入门
https://support.microsoft.com/zh-cn/office/office-%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8-25f909da-3e76-443d-94f4-6cdf7dedc51e
office-应用帮助和培训
https://support.microsoft.com/zh-cn/office/office-%E5%BA%94%E7%94%A8%E5%B8%AE%E5%8A%A9%E5%92%8C%E5%9F%B9%E8%AE%AD-8b9042aa-7507-477b-b294-1b178b47c8e5

Win11切换到旧版右键菜单:

reg add "HKCU\Software\Classes\CLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

恢复回Win11右键菜单:

reg delete "HKCU\Software\Classes\CLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f

重启Windows资源管理器生效。

taskkill /f /im explorer.exe & start explorer.exe

写成BAT,如下

echo Win11切换到旧版右键菜单:

    reg add "HKCU\Software\Classes\CLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

echo 重启Windows资源管理器生效。

    taskkill /f /im explorer.exe & start explorer.exe





21H2

@echo off
:start
cls
echo,
echo 修改右键菜单模式
echo,
echo 1 穿越到Windows 10默认模式
echo,
echo 2 恢复为Windows 11默认模式
echo,
echo 0 什么也不做,退出
echo,
echo,
choice /c:120 /n /m:"请选择要进行的操作(1/2/0):"
if %errorlevel%==0 exit
if %errorlevel%==2 goto cmd2
if %errorlevel%==1 goto cmd1
exit
:cmd1
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
taskkill /f /im explorer.exe
start explorer.exe
exit
:cmd2
reg.exe delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f
taskkill /f /im explorer.exe
start explorer.exe
exit

现在已经有个工具,Windows 11 Classic Context Menu
使用工具更方便
https://www.sordum.org/14479/windows-11-classic-context-menu-v1-1/

不需要密码删除 亚信安全officescan
因为杀毒软件损坏,需要修复性重装,但是又报错
趋势官网不提供删除工具,需要找技术支持,CUT工具每个季度会更新
百度一下,找到这个结果

一定要在 安全模式 下运行
进入安全模式
Win7以前进系统前按F8
Win10及以后在 更新和安全--恢复--高级启动 里进入安全模式

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.]
"Allow Uninstall"=dword:00000001

进入注册表

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.

将Allow Uninstall的值 0 改为 1

然后在 安全模式 下,不需要密码直接卸载 officescan

删除残留文件,重新安装

Although WordPress can work in almost any environment, even very minimal ones, it must be acknowledged that it does not work completely well in these. That’s why here we are going to make some minimum recommendations of the environment in which it would work most effectively.

https://make.wordpress.org/hosting/handbook/server-environment/

Web Server #Web Server
The web server is the software dedicated to run the files of the website and where users come to consult them, mainly through the Web.

There are many web servers and, generally, any that support the execution of PHP files should be able to work with WordPress.

When it comes to the server, web, WordPress officially supports:

Apache HTTPD 2.4
nginx 1.20 / 1.19
http://nginx.org/download/nginx-1.21.3.tar.gz
Also, checked or used by hosting companies and developers:

LiteSpeed Web Server 6.0 / 5.4 / 5.3
OpenLiteSpeed 1.7 / 1.6 / 1.5 / 1.4
WordPress may work with older versions, but we recommend only versions that are stable and supported.

Remember that if you have a website running in production, it is recommended to use the latest stable version of each of the web servers (mainly for security, rather than functionality), but not alpha, beta or candidate (RC) versions.

PHP #PHP
PHP is a programming language on which WordPress code is based. This language runs on the server and it is important to keep it up to date, both for security and functionality.

WordPress supports many versions of PHP, some even obsolete, but as a general rule you should use only those with security or stable support.

Officially the WordPress core supports from PHP 5.6.20 to PHP 8.0. However, not all themes or plugins are supported.

When it comes to PHP, WordPress works best with the following versions:

PHP 8.0
PHP 7.4
https://www.php.net/distributions/php-8.0.11.tar.gz
https://www.php.net/distributions/php-7.4.24.tar.gz

必须安装扩展
curl,dom,exif,fileinfo,hash,imagick,json,mbstring,mysqli,openssl,pcre,sodium,xml,zip,
推荐安装扩展
bcmath,filter,gd,iconv,intl,mcrypt,simplexml,xmlreader,zlib,

另外安装服务
ssh2,ftp,sockets,
系统扩展
ImageMagick,Ghost Script

数据库
MariaDB 10.5 / 10.4 / 10.3 / 10.2
MySQL 8.0 / 5.7
https://dev.mysql.com/downloads/mysql/
https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.26-1.el8.x86_64.rpm-bundle.tar
https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-server-8.0.26-1.el8.x86_64.rpm

推荐运平台数据库
Amazon Aurora
Amazon RDS for MariaDB
Amazon RDS for MySQL
Google Cloud SQL
Percona MySQL Server 8.0

NGINX
https://www.icode9.com/content-3-1087281.html
http://nginx.org/en/linux_packages.html#RHEL-CentOS

PHP8
https://wvww.cn/15.html

MYSQL
https://www.gaoxiaobo.com/web/server/169.html

systemctl stop firewalld
https://blog.csdn.net/weixin_46106069/article/details/114700217
https://blog.csdn.net/qq_39289155/article/details/111501000

linux服务器nginx安装资源(nginx、openssl、pcre、zlib、gcc、gcc-c++)

./configure --prefix=/usr/local/libiconv

yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel sqlite-devel net-tools

yum -y install ntpdate gcc gcc-c++ ncurses ncurses-devel cmake readline-devel zlib.x86_64 zlib-devel.x86_64 bison libcurl- net-tool tree nmap sysstat lrzsz dos2unix telnet.x86_64 nethogs iftop iotop unzip ftp.x86_64 xfs expect vim wget psmisc openssh-client libaio libaio1 libnuma openssl-devel bzip2

https://blog.51cto.com/u_15162069/2699925

https://www.gaoxiaobo.com/web/server/169.html


1、首先下载mysql-8.0.26 RPM安装包。

官方rpm包下载地址:https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar

2、解压tar包
tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar

3、安装mysql-common

rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm

4、安装mysql-client-plugins
rpm -ivh mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm

5、安装mysql-community-libs
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm

6、安装mysql-community-client
rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm

7、安装mysql-community-server
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm

报错,提示缺少net-tools
error: Failed dependencies:
net-tools is needed by mysql-community-server-8.0.26-1.el7.x86_64

安装net-tools
yum install -y net-tools*

再次执行上述mysql-community-server安装命令,OK了,可以正常安装。

8、启动mysql
service mysqld start

9、mysql8.0版本后,启动时会生成初始密码,在/var/log/mysqld.log日志中,查看初始密码
grep 'temporary password' /var/log/mysqld.log

mysql -u root -p
show databases;
use mysql;

10、登录mysql,修改root用户密码,开启远程登录权限

mysql 8.*修改的密码强度需要包含大小写字母、特殊符号、数字,否则将报错修改失败

alter user 'root'@'localhost' identified by 'password';

use mysql
update user set host = '%' where user='root';
flush privileges;

作者:只是甲
链接:https://www.jianshu.com/p/090e4a055713
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

必须安装扩展
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/conf --enable-curl --enable-dom --enable-exif --enable-fileinfo--enable-hash --enable-imagick --enable-json --enable-mbstring--enable-mysqli --enable-openssl --enable-pcre --enable-sodium--enable-xml --enable-zip --enable-bcmath --enable-filter --enable-gd--enable-iconv --enable-intl --enable-mcrypt --enable-simplexml --enable-xmlreader --enable-zlib--with-pdo-mysql --with-openssl --with-curl --with-gd --with-gettext--with-mhash --with-openssl --with-mcrypt --with-tidy --enable-wddx--with-xmlrpc --with-zlib