Web服务器群集:OpenEuler 部署 LAMP(LNMP) 基础服务

目录

  一、实验

1.环境

2. 网络配置

3. MobaXterm远程连接

4. apache 2.4.58 源码编译安装

5. php 8.3.1源码编译安装

6.配置httpd 连接 php-fpm

6. nginx 1.24.0源码编译安装

7. mysql 8.0.36安装

二、问题

1.MobaXterm设置右键复制粘贴

2.OpenEuler如何查看CPU的核数

3. Web 浏览器不显示 htdocs 目录中的 index.html

4.设置httpd开机自启报错


  一、实验

1.环境

(1)主机

表1  主机

系统架构版本IP备注
LinuxopenEuler22.03 LTS SP2

192.168.204.131(动态)

192.168.204.141(静态)

192.168.204.142(静态)

apache2.4.58
php8.3.1
nginx1.24.0
mysql8.0.36

(2)查看系统版本

[root@localhost ~]# cat /etc/os-release

(3) 查看当前运行服务

[root@localhost ~]# systemctl list-units --type service | grep running

(4)查看服务文件

[root@localhost ~]# systemctl list-unit-files

2. 网络配置

(1)编辑

目标:配置三个ip,一个动态分配,二个是静态ip

[root@localhost network-scripts]# vim ifcfg-ens33 +$

+$ 直接移动到文件末尾编辑

(2)修改

修改前:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
UUID=bbe3cde3-938d-4fad-8ec7-fe30c5cd98de
DEVICE=ens33
ONBOOT=yes

修改后:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
UUID=bbe3cde3-938d-4fad-8ec7-fe30c5cd98de
DEVICE=ens33
ONBOOT=yesIPADDR1=192.168.204.141
IPADDR2=192.168.204.142
NETMASK=255.255.255.0
GATEWAY=192.168.204.2
DNS1=114.114.114.114
DNS2=192.168.204.2

(3)重启服务

[root@localhost network-scripts]# systemctl restart NetworkManager
[root@localhost network-scripts]# systemctl status NetworkManager

(4)重启主机

 [root@localhost network-scripts]# sudo reboot

(5)查看

 [root@localhost ~]# ip addr

一个动态分配(192.168.204.131),二个是静态ip(192.168.204.141、192.168.204.142)

3. MobaXterm远程连接

(1)下载

MobaXterm free Xserver and tabbed SSH client for Windows (mobatek.net)

(2)设置SSH

接受(Accept)

弹出对话框(如不需要免密,可以取消关闭)

输入密码登录

(3)设置免密

输入密码(登录免密)

(4)更新

[root@localhost ~]# sudo dnf update -y

(5)再次更新

[root@localhost ~]# sudo dnf update -y

提示已更新

4. apache 2.4.58 源码编译安装

(1) 官网

Download - The Apache HTTP Server Project

(2)下载

wget https://dlcdn.apache.org/httpd/httpd-2.4.58.tar.gz

(3) 安装依赖组件

[root@localhost ~]# sudo dnf install -y apr-devel apr-util-devel pcre-devel openssl-devel bzip2 tar gcc gcc-c++ make

(4)解压

[root@localhost opt]# tar zxvf httpd-2.4.58.tar.gz

(5)切换目录

[root@localhost opt]# cd httpd-2.4.58

(6)安装前配置

[root@localhost httpd-2.4.58]# sudo ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite

完成

(7)编译

[root@localhost httpd-2.4.58]# sudo make -j 8

完成

(8)安装

默认安装位置是 /usr/local/apache

[root@localhost httpd-2.4.58]# sudo make install

完成:

(9)编写服务配置文件

sudo vim /usr/lib/systemd/system/httpd.service
 [Unit] Description=The Apache HTTP ServerAfter=network.target[Service] Type=forkingExecStart=/usr/local/apache/bin/apachectl $OPTIONSExecReload=/usr/local/apache/bin/apachectl $OPTIONSExecStop=/bin/kill -HUP $MAINPIDKillMode=processRestart=on-failure[Install] WantedBy=multi-user.target

(10)服务操作


[root@localhost httpd-2.4.58]# sudo vim /etc/systemd/system/httpd.service[root@localhost httpd-2.4.58]# sudo systemctl enable httpd[root@localhost httpd-2.4.58]# sudo systemctl enable --now httpd[root@localhost httpd-2.4.58]# sudo systemctl daemon-reload[root@localhost httpd-2.4.58]#  sudo systemctl start httpd

(11)防火墙操作

[root@localhost httpd-2.4.58]# sudo firewall-cmd --zone=public --add-port=80/tcp --permanent[root@localhost httpd-2.4.58]#  sudo firewall-cmd --reload

(12)测试

[root@localhost httpd-2.4.58]# curl localhost

(13)查看版本信息

[root@localhost httpd-2.4.58]#  /usr/local/apache/bin/httpd -v

查看服务状态

[root@localhost httpd-2.4.58]# sudo systemctl status httpd

(14)访问

http://192.168.204.141/

5. php 8.3.1源码编译安装

(1) 官网

PHP: Downloads

(2)下载

wget https://www.php.net/distributions/php-8.3.1.tar.gz

(3)安装依赖组件

[root@localhost opt]# sudo dnf install -y tar gcc gcc-c++ make

sudo dnf install -y bzip2-devel libcurl-devel libxml2-devel sqlite-devel oniguruma oniguruma-devel libxml2-devel bzip2-devel libcurl-devel libjpeg-devel zstd libzstd-devel libcurl-devel libpng-devel libffi-devel libjpeg-devel libpng-devel sqlite-devel libwebp libwebp-devel openssl-devel libzip-devel

完成

(4)解压缩并进入源码目录

[root@localhost opt]# tar zxvf php-8.3.1.tar.gz

[root@localhost opt]# cd php-8.3.1

(5)配置

sudo ./configure --prefix=/usr/local/php --enable-gd --with-webp --with-jpeg --with-mhash --enable-mbstring --with-imap-ssl --with-mysqli --with-pdo-mysql --enable-exif --with-ffi --with-zip --enable-sockets --with-openssl --with-pcre-jit --enable-fpm --enable-pcntl

完成

(6)编译

[root@localhost php-8.3.1]# sudo make -j 8

完成

(7)安装

[root@localhost php-8.3.1]# sudo make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20230831/
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/php/sbin/
Installing PHP FPM defconfig:     /usr/local/php/etc/
Installing PHP FPM man page:      /usr/local/php/php/man/man8/
Installing PHP FPM status page:   /usr/local/php/php/php/fpm/
Installing phpdbg binary:         /usr/local/php/bin/
Installing phpdbg man page:       /usr/local/php/php/man/man1/
Installing PHP CGI binary:        /usr/local/php/bin/
Installing PHP CGI man page:      /usr/local/php/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:          /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/program: phpizeprogram: php-config
Installing man pages:             /usr/local/php/php/man/man1/page: phpize.1page: php-config.1
Installing PDO headers:           /usr/local/php/include/php/ext/pdo/

(8)查看

[root@localhost php-8.3.1]# whereis php
php: /usr/local/php[root@localhost php-8.3.1]# cd /usr/local/php/bin/[root@localhost bin]# ./php -v
PHP 8.3.1 (cli) (built: Feb 27 2024 01:28:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.1, Copyright (c) Zend Technologies[root@localhost bin]# ./php --ini
Configuration File (php.ini) Path: /usr/local/php/lib
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

查看组件

[root@localhost bin]# ./php --ri gdgdGD Support => enabled
GD Version => bundled (2.1.0 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 6b
PNG Support => enabled
libPNG Version => 1.6.38
WBMP Support => enabled
XBM Support => enabled
WebP Support => enabled
BMP Support => enabled
TGA Read Support => enabledDirective => Local Value => Master Value
gd.jpeg_ignore_warning => On => On
[root@localhost bin]# ./php --ri pdoPDOPDO support => enabled
PDO drivers => mysql, sqlite
[root@localhost bin]#

(9)修改配置文件

[root@localhost bin]# cd /usr/local/php/etc/[root@localhost etc]# ls
php-fpm.conf.default  php-fpm.d[root@localhost etc]#  mv php-fpm.conf.default php-fpm.conf[root@localhost etc]# ls
php-fpm.conf  php-fpm.d[root@localhost etc]# cd php-fpm.d/[root@localhost php-fpm.d]# ls
www.conf.default[root@localhost php-fpm.d]#  mv www.conf.default www.conf[root@localhost php-fpm.d]# ls
www.conf

(10)复制服务配置文件

[root@localhost fpm]# cp /opt/php-8.3.1/sapi/fpm/php-fpm.service /usr/lib/systemd/system/

(11)查看配置文件

[root@localhost fpm]# sudo vim  /usr/lib/systemd/system/php-fpm.service

# It's not recommended to modify this file in-place, because it
# will be overwritten during upgrades.  If you want to customize,
# the best way is to use the "systemctl edit" command.[Unit]
Description=The PHP FastCGI Process Manager
After=network.target[Service]
Type=simple
PIDFile=/usr/local/php/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID# Set up a new file system namespace and mounts private /tmp and /var/tmp directories
# so this service cannot access the global directories and other processes cannot
# access this service's directories.
PrivateTmp=true# Mounts the /usr, /boot, and /etc directories read-only for processes invoked by this unit.
ProtectSystem=full# Sets up a new /dev namespace for the executed processes and only adds API pseudo devices
# such as /dev/null, /dev/zero or /dev/random (as well as the pseudo TTY subsystem) to it,
# but no physical devices such as /dev/sda.
PrivateDevices=true# Explicit module loading will be denied. This allows to turn off module load and unload
# operations on modular kernels. It is recommended to turn this on for most services that
# do not need special file systems or extra kernel modules to work.
ProtectKernelModules=true# Kernel variables accessible through /proc/sys, /sys, /proc/sysrq-trigger, /proc/latency_stats,
# /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq will be made read-only to all processes
# of the unit. Usually, tunable kernel variables should only be written at boot-time, with the
# sysctl.d(5) mechanism. Almost no services need to write to these at runtime; it is hence
# recommended to turn this on for most services.
ProtectKernelTunables=true# The Linux Control Groups (cgroups(7)) hierarchies accessible through /sys/fs/cgroup will be
# made read-only to all processes of the unit. Except for container managers no services should
# require write access to the control groups hierarchies; it is hence recommended to turn this on
# for most services
ProtectControlGroups=true# Any attempts to enable realtime scheduling in a process of the unit are refused.
RestrictRealtime=true# Restricts the set of socket address families accessible to the processes of this unit.
# Protects against vulnerabilities such as CVE-2016-8655
RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX# Takes away the ability to create or manage any kind of namespace
RestrictNamespaces=true[Install]
WantedBy=multi-user.target

修改后:

# It's not recommended to modify this file in-place, because it
# will be overwritten during upgrades.  If you want to customize,
# the best way is to use the "systemctl edit" command.[Unit]
Description=The PHP FastCGI Process Manager
After=network.target[Service]
Type=simple
PIDFile=/usr/local/php/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID# Set up a new file system namespace and mounts private /tmp and /var/tmp directories
# so this service cannot access the global directories and other processes cannot
# access this service's directories.
PrivateTmp=true# Takes away the ability to create or manage any kind of namespace
RestrictNamespaces=true[Install]
WantedBy=multi-user.target

(12)启动

[root@localhost fpm]# sudo systemctl enable --now php-fpm[root@localhost fpm]# sudo systemctl status php-fpm

(13) 申明变量

[root@localhost fpm]# sudo vim /etc/profile +$

export PATH=.:$PATH:/usr/local/php/bin

更新

[root@localhost fpm]# source /etc/profile

(14)查看版本

[root@localhost fpm]# php -v

(15)查看模块

[root@localhost fpm]# php -m
[PHP Modules]
Core
ctype
date
dom
exif
FFI
fileinfo
filter
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
Reflection
session
SimpleXML
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip[Zend Modules]

6.配置httpd 连接 php-fpm

(1)创建目录

[root@localhost ~]# mkdir -p /var/www

(2)创建网页文件

[root@localhost ~]# sudo vim /var/www/index.php

<?php
phpinfo();

(3)修改配置文件

[root@localhost ~]#  vim /usr/local/apache/conf/httpd.conf

开启序号

set nu

启用119行

启用123行

修改189行

修改198行

修改257行

大G 切换最后一行

(4) 重启主机

[root@localhost ~]# sudo reboot

(5)重启服务

[root@localhost ~]# sudo systemctl daemon-reload
[root@localhost ~]# sudo systemctl start httpd
[root@localhost ~]# sudo systemctl status httpd

(6)访问

http://192.168.204.141/index.php

gd组件

pdo组件

版本

(7)修改时区

复制配置文件

[root@localhost ~]# ls /usr/local/php/lib
php[root@localhost ~]# cd /opt/php-8.3.1/[root@localhost php-8.3.1]# ls
appveyor             configure.ac     Makefile.fragments   scripts
benchmark            CONTRIBUTING.md  Makefile.objects     SECURITY.md
build                docs             modules              tests
buildconf            ext              NEWS                 travis
buildconf.bat        EXTENSIONS       pear                 TSRM
CODEOWNERS           include          php.ini-development  UPGRADING
CODING_STANDARDS.md  libs             php.ini-production   UPGRADING.INTERNALS
config.log           libtool          README.md            win32
config.nice          LICENSE          README.REDIST.BINS   Zend
config.status        main             run-tests.php
configure            Makefile         sapi[root@localhost php-8.3.1]# sudo cp php.ini-production  /usr/local/php/lib/php.ini[root@localhost php-8.3.1]#  sudo vim /usr/local/php/lib/php.ini

搜索timezone

修改前:

修改后:

date.timezone = PRC

重启服务

[root@localhost php-8.3.1]# sudo systemctl restart php-fpm

测试

sudo vim /var/www/d.php<?phpecho date('Y-m-d H:i:s')

6. nginx 1.24.0源码编译安装

(1) 官网

Index of /download/ (nginx.org)

(2)下载

 wget http://nginx.org/download/nginx-1.24.0.tar.gz

(3)解压

[root@localhost opt]#  tar zxvf nginx-1.24.0.tar.gz

(4)安装依赖组件

[root@localhost opt]# sudo dnf install -y pcre-devel openssl openssl-devel gcc gcc-c++ make

(5)切换目录

[root@localhost opt]# cd nginx-1.24.0

(6)配置

自动配置 默认安装在/usr/local/nginx 目录下

[root@localhost nginx-1.24.0]# sudo ./configure

完成

(7)编译

[root@localhost nginx-1.24.0]# sudo make -j 8

完成

(8)安装

[root@localhost nginx-1.24.0]# sudo make install

(9)查看

[root@localhost nginx-1.24.0]# whereis nginx

(10)配置服务文件

[root@localhost nginx-1.24.0]#  sudo vim /usr/lib/systemd/system/nginx.service

 [Unit]Description=nginxAfter=network.target remote-fs.target nss-lookup.target[Service]Type=forkingExecStart=/usr/local/nginx/sbin/nginxExecReload=/usr/local/nginx/sbin/nginx -s reloadExecStop=/usr/local/nginx/sbin/nginx -s stopPrivateTmp=true[Install]WantedBy=multi-user.target

(11)配置nginx

[root@localhost nginx-1.24.0]# sudo vim /usr/local/nginx/conf/nginx.conf

修改前:

修改后:添加index.php

取消注释

修改前:

修改后:添加 $document_root

(12)启动

如httpd占用80端口,需要将其关闭

[root@localhost nginx-1.24.0]# ps -ef |grep httpd

[root@localhost nginx-1.24.0]# sudo systemctl stop httpd

[root@localhost nginx-1.24.0]# sudo reboot

启动nginx服务


[root@localhost ~]#  sudo systemctl enable --now nginx[root@localhost ~]# sudo systemctl status nginx

查看进程

[root@localhost ~]# ps -ef |grep nginx

查看端口占用

[root@localhost ~]# netstat -antpl

(13)配置环境变量

[root@localhost sbin]# vim /etc/profile
[root@localhost sbin]# source /etc/profile

export PATH=.:$PATH:/usr/local/php/bin:/usr/local/nginx/sbin

查看版本

[root@localhost sbin]# nginx -v

(14)新建文件

[root@localhost ~]# sudo vim /usr/local/nginx/html/index.php

<?phpphpinfo();

(15)访问

http://192.168.204.141/

查看nginx版本

7. mysql 8.0.36安装

(1) 官网

MySQL :: Download MySQL Community Server

(2)下载

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.36-linux-glibc2.28-x86_64.tar.xz

(3) 新建用户

[root@localhost opt]# groupadd -r -g 306 mysql
[root@localhost opt]# useradd -r -u 306 -g 306 -s /bin/false mysql

(4)解压

[root@localhost opt]# tar xf mysql-8.0.36-linux-glibc2.28-x86_64.tar.xz -C /usr/local/

(5)软链接

[root@localhost opt]# ln -s /usr/local/mysql-8.0.36-linux-glibc2.28-x86_64/ /usr/local/mysql

(6)初始化

需要记住最后生成的密码

[root@localhost opt]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2024-02-27T13:11:56.263920Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.36) initializing of server in progress as process 2504
2024-02-27T13:11:56.298069Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-02-27T13:11:57.751470Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-02-27T13:12:04.149485Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >.BjWK3q(qAp

(7)提供配置文件和服务脚本

[root@localhost opt]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost opt]# chkconfig --add mysqld
[root@localhost opt]# chkconfig mysqld on


[root@localhost opt]# vim /etc/my.cnf.d/mysql-server.cnf[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql/
socket=/tmp/mysql.sock
log-error=/usr/local/mysql/data/mysqld.log
pid-file=/usr/local/mysql/mysqld.pid

(8)配置环境变量

[root@localhost opt]# echo 'export PATH=$PATH:/usr/local/mysql/bin/' > /etc/profile.d/mysql.sh
[root@localhost opt]#  source /etc/profile.d/mysql.sh

(9)重启服务

[root@localhost opt]# systemctl restart mysqld

(10)查看版本

[root@localhost opt]# mysql -V

(11)修改密码


[root@localhost opt]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.36Copyright (c) 2000, 2024, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> alter user root@localhost identified by 'Admin@123';
Query OK, 0 rows affected (0.07 sec)mysql-> \q
Bye

二、问题

1.MobaXterm设置右键复制粘贴

(1)点击设置

(2)终端

取消右键粘贴

2.OpenEuler如何查看CPU的核数

(1)查看CPU的核数

1)CPU总核数 	= 物理CPU个数 * 每颗物理CPU的核数 2)逻辑CPU总数 = 物理CPU个数 * 每颗物理CPU的核数 * 超线程数3)多核超线程:1>多个物理CPU:	物理CPU间通过总线进行通信,效率比较低。1>多核CPU:		不同的核通过L2 cache进行通信,存储和外设通过总线与CPU通信。2>超线程:		每个核有两个逻辑的处理单元,两个处理单元共享一个核的资源。

(2)查看

#查看CPU的型号
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c#查看物理CPU的个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l#查看每颗物理CPU的核数
cat /proc/cpuinfo| grep "cpu cores"| uniq#查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l#计算超线程数:
逻辑CPU/CPU总核数 
# 8/(2*4)=1

3. Web 浏览器不显示 htdocs 目录中的 index.html

(1)报错

(2)原因分析

查看版本,系统更新默认dnf 安装了 httpd ,所以默认配置文件在 /etc/httpd/conf/httpd.conf

[root@localhost httpd-2.4.58]# httpd -v

查看配置文件,此为dnf安装的配置文件

[root@localhost httpd-2.4.58]# sudo vim /usr/lib/systemd/system/httpd.service

# See httpd.service(8) for more information on using the httpd service.# Modifying this file in-place is not recommended, because changes
# will be overwritten during package upgrades.  To customize the
# behaviour, run "systemctl edit httpd" to create an override unit.# For example, to pass additional options (such as -D definitions) to
# the httpd binary at startup, create an override unit (as is done by
# systemctl edit) and enter the following:#       [Service]
#       Environment=OPTIONS=-DMY_DEFINE[Unit]
Description=The Apache HTTP Server
Wants=httpd-init.service
After=network.target remote-fs.target nss-lookup.target httpd-init.service
Documentation=man:httpd.service(8)[Service]
Type=notify
Environment=LANG=CExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecStartPost=/usr/bin/sleep 0.1
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
# Send SIGWINCH for graceful stop
KillSignal=SIGWINCH
KillMode=mixed
PrivateTmp=true[Install]
WantedBy=multi-user.target

(3)解决方法

卸载 dnf安装的httpd

[root@localhost httpd-2.4.58]# dnf remove httpd

 编写编译安装服务配置文件

sudo vim /usr/lib/systemd/system/httpd.service
 [Unit] Description=The Apache HTTP ServerAfter=network.target[Service] Type=forkingExecStart=/usr/local/apache/bin/apachectl $OPTIONSExecReload=/usr/local/apache/bin/apachectl $OPTIONSExecStop=/bin/kill -HUP $MAINPIDKillMode=processRestart=on-failure[Install] WantedBy=multi-user.target

服务操作

[root@localhost httpd-2.4.58]# sudo vim /etc/systemd/system/httpd.service[root@localhost httpd-2.4.58]# sudo systemctl enable httpd[root@localhost httpd-2.4.58]# sudo systemctl enable --now httpd[root@localhost httpd-2.4.58]# sudo systemctl daemon-reload[root@localhost httpd-2.4.58]#  sudo systemctl start httpd

成功:

http://192.168.204.141/

4.设置httpd开机自启报错

(1)报错

[root@localhost httpd-2.4.58]# sudo systemctl enable httpd
Failed to enable unit: File httpd.service: Bad message

(2)原因分析

配置文件格式错误

(3)解决方法

修改配置文件

[root@localhost httpd-2.4.58]#  sudo vim /etc/systemd/system/httpd.service

修改前:

修改后:

成功:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/707046.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

使用Node.js开发一个文件上传功能

在现代 Web 应用程序开发中&#xff0c;文件上传是一个非常常见且重要的功能。今天我们将通过 Node.js 来开发一个简单而强大的文件上传功能。使用 Node.js 来处理文件上传可以带来许多好处&#xff0c;包括简单的代码实现、高效的性能和灵活的配置选项。 首先&#xff0c;我们…

【kubernetes】关于k8s集群的资源发布方式(灰度/滚动发布)

目录 一、常见的发布方式 二、详解kubectl陈述式方式做灰度发布&#xff08;金丝雀发布&#xff09; 步骤一&#xff1a;先基于deployment控制器创建pod&#xff0c;然后发布 步骤二&#xff1a;基于命令行灰度发布 步骤三&#xff1a;测试等到版本稳定以后&#xff0c;再完…

远程解难:苹果手机投屏到Windows电脑,给爸妈演示手机操作

明窗净几夜未央&#xff0c; 键盘轻敲解忧忙。 父母笑颜消难题&#xff0c; 孝心科技共光芒。 QQ、微信、小红书等社交软件不仅年轻人在用&#xff0c;老年人也逐步使用社交软件建立起自己的朋友圈。但这些“新”软件对于部分老年人来说还是太复杂&#xff0c;这就难免需要年…

Mysql常见用法(2)

目录​​​​​​​ mysql 约束 primary key 主键的基本使用 notnull(非空) unique(唯一) foreign key(外键) check 自增长 mysql索引 索引的原理 索引的类型 索引的使用 --添加索引 删除索引&#xff1a; -- 修改索引 &#xff0c; 先删除&#xff0c;在添加新…

liunx单机项目部署

文章目录 1.liunx简介2.liunx的jdk安装2.liunx的tomcat安装3.liunx的mysql安装4.单机项目部署 1.liunx简介 Linux&#xff0c;一般指GNU/Linux&#xff08;单独的Linux内核并不可直接使用&#xff0c;一般搭配GNU套件&#xff0c;故得此称呼&#xff09;&#xff0c;是一种免费…

【C语言】学生宿舍信息管理系统

目录 项目说明 1. 数据结构设计 2. 功能实现 3. 主菜单设计 4. 文件操作 5. 系统使用 项目展示 1.主菜单功能界面 ​编辑 2.添加信息 3.查询信息 4.修改信息 5.删除信息 6.退出程序 项目完整代码 结语 在这篇博客中&#xff0c;我们将探讨如何使用C语言来开发…

【Hudi】核心概念

https://www.bilibili.com/video/BV1ue4y1i7na?p17&vd_sourcefa36a95b3c3fa4f32dd400f8cabddeaf 大数据新风口&#xff1a;Hudi数据湖&#xff08;尚硅谷&Apache Hudi联合出品&#xff09; 1 基础概念 1.1 时间轴(TimeLine) 1.2 文件布局(File Layout) 1.3 索引(In…

JavaWeb个人学习01

1:RequestParam(defaultValue "默认的值") 这个可以在一个参数的前面写上 要是前端不传值进来的话 这个形参就是你定义的默认值 2: slf4j 对应的是日志的输出 log.info("参数是 {}", detail); 3: 分页插件 PageHelper 用法: 准备工作: 引入依赖 …

【OpenCV C++】Mat img.total() 和img.cols * img.rows 意思一样吗?二者完全相等吗?

文章目录 1 结论及区别2 Mat img的属性 介绍1 结论及区别 在大多数情况下,img.total() 和 img.cols * img.rows 是相等的,但并不总是完全相等的。下面是它们的含义和一些区别: 1.img.total() 表示图像中像素的总数,即图像的总像素数量。2.img.cols * img.rows 也表示图像中…

React UI框架Antd 以及 如何按需引入css样式配置(以及过程中各种错误处理方案)

一、react UI框架Antd使用 1.下载模块 npm install antd -S 2.引入antd的样式 import ../node_modules/antd/dist/reset.css; 3.局部使用antd组件 import {Button, Calendar} from antd; import {PieChartTwoTone} from ant-design/icons; {/* 组件汉化配置 */} import l…

【Java设计模式】四、适配器模式

文章目录 1、适配器模式2、举例 1、适配器模式 适配器模式Adapter Pattern&#xff0c;是做为两个不兼容的接口之间的桥梁目的是将一个类的接口转换成客户希望的另外一个接口适配器模式可以使得原本由于接口不兼容而不能一起工作的那些类可以一起工作 最后&#xff0c;适配器…

Javase补充-Arrays类的常用方法汇总

文章目录 一 . 排序方法二 . 查找方法三 . 判断是否相等的方法四 . 拷贝方法五 . 填充方法 一 . 排序方法 我们第一个要介绍的就是sort方法 这个排序实现的底层逻辑应该是十分复杂的,以我们目前的水平体系应该无法理解,我们今天尝试用我们可以理解的一种排序算法,插入排序来模…

DEPART: Replica Decoupling for Distributed Key-Value Storage——论文泛读

FAST 2022 Paper 论文阅读笔记整理 问题 现代分布式KV存储通过在节点之间分发KV对的副本来采用复制以实现容错。然而&#xff0c;现有的分布式KV存储通常在同一索引结构中管理所有副本&#xff0c;例如LSM-Tree&#xff0c;从而导致复制冗余之外的大量I/O成本。 本文方法 提…

禁止safari浏览器网页双击缩放功能

普通浏览器 普通浏览器&#xff0c;只需要增加meta标签禁止缩放功能就行了 <meta content"widthdevice-width, initial-scale1.0, maximum-scale1.0, user-scalable0;" name"viewport" /> user-scalableno或0 //禁止双指缩放页面initial-scale1.0…

【喜讯】优积科技CEO刘其东当选第十届杨浦区科协常委委员!

2023年09月21日&#xff0c;上海市杨浦区科学技术协会第十次代表大会于杨浦区人民政府机关2号楼四楼礼堂隆重召开&#xff01;公司CEO刘其东、COO周兴文、CPO胡艳玲、PM何壮志等来自全区各界的近三百名科技工作者代表参加会议。 大会现场 上海市杨浦区委书记薛侃&#xff0c;上…

Flutter中高级JSON处理:使用json_serializable进行深入定制

Flutter中高级JSON处理 使用json_serializable库进行深入定制 - 文章信息 - Author: 李俊才 (jcLee95) Visit me at: https://jclee95.blog.csdn.netEmail: 291148484163.com. Shenzhen ChinaAddress of this article:https://blog.csdn.net/qq_28550263/article/details/1363…

针对KZG承诺和高效laconic OT的extractable witness encryption

1. 引言 2024年以太坊基金会等成员论文 Extractable Witness Encryption for KZG Commitments and Efficient Laconic OT&#xff0c;开源代码实现见&#xff1a; https://github.com/rot256/research-we-kzg&#xff08;Rust&#xff09; 在该论文中&#xff0c;提供了一种…

OpenAI划时代大模型——文本生成视频模型Sora作品欣赏(八)

Sora介绍 Sora是一个能以文本描述生成视频的人工智能模型&#xff0c;由美国人工智能研究机构OpenAI开发。 Sora这一名称源于日文“空”&#xff08;そら sora&#xff09;&#xff0c;即天空之意&#xff0c;以示其无限的创造潜力。其背后的技术是在OpenAI的文本到图像生成模…

5G-A,未来已来

目前&#xff0c;全国首个5G-A规模组网示范完成。这项由北京联通携手华为共同打造的示范项目&#xff0c;实现了北京市中心金融街、历史建筑长话大楼、大型综合性体育场北京工人体育场三个重点场景的连片覆盖。 实际路测结果显示&#xff0c;5G-A用户下行峰值速率达到10Gbps&am…

了解docker与k8s

随着 k8s 作为容器编排解决方案变得越来越流行&#xff0c;有些人开始拿 Docker 和 k8s 进行对比&#xff0c;不禁问道&#xff1a;Docker 不香吗&#xff1f; k8s 是 kubernetes 的缩写&#xff0c;8 代表中间的八个字符。 其实 Docker 和 k8s 并非直接的竞争对手两者相互依存…