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://xiahunao.cn/news/2814505.html

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

SQL注入漏洞解析-less-8(布尔盲注)

我们来看一下第八关 当我们进行尝试时&#xff0c;他只有You are in...........或者没有显示。 他只有对和错显示&#xff0c;那我们只能用对或者错误来猜他这个数据库 ?id1%27%20and%20ascii(substr(database(),1,1))>114-- ?id1%27%20and%20ascii(substr(database(),1,…

防火墙的内容安全

目录 1. 内容安全 1.1 IAE引擎 DPI---深度包检测技术 DFI---深度流检测技术 结论(优缺点)&#xff1a; 1.2 入侵防御&#xff08;检测&#xff09;(IPS) IPS的优势: 入侵检测的方法: 入侵检测的流程 签名 查看预定义签名的内容 新建自定义签名 入侵防御的检测…

什么时候要用到Reflect API?

参考文档 https://www.zhihu.com/question/460133198 https://cn.vuejs.org/guide/extras/reactivity-in-depth.html https://juejin.cn/post/7103764386220769311 Reflect API 一般搭配 Proxy API 一起使用。什么是 Proxy API 呢&#xff1f; 先回顾下 vue 的数据响应性是如何…

没有货币化,郎酒也能用大营销让经销商赚到钱?

文&#xff5c;琥珀食酒社 作者 | 五画 一年卖一千亿&#xff0c;这是郎酒在去年9月8日定下的目标。 当时正值第三届郎酒庄园会员节之际&#xff0c;郎酒集团董事长汪俊林从使命、愿景、价值观等十二个方面发布“百年郎酒”总纲领。 为郎酒立下新的“351”工程发展目标&…

HarmonyOS—使用数据模型和连接器

Serverless低代码开发平台是一个可视化的平台&#xff0c; 打通了HarmonyOS云侧与端侧能力&#xff0c;能够轻松实现HMS Core、AGC Serverless能力调用。其中&#xff0c;数据模型和连接器是两大主要元素。开发者在使用DevEco Studio的低代码功能进行开发时&#xff0c;可以使用…

行为树入门:BehaviorTree.CPP Groot2练习(叶子节点)(2)

以《行为树BehaviorTree学习记录1_基本概念》练习。 1 SequenceNode顺序控制节点 代码下载 git clone https://gitee.com/Luweizhiyuan2020/ros2_bt.git例程 1.1 sequence 顺序执行 下载版本SequenceNode1。 1.2 ReactiveSequence 异步执行 注意&#xff1a; ①only a…

【算法 - 动态规划】找零钱问题Ⅰ

在前面的动态规划系列文章中&#xff0c;关于如何对递归进行分析的四种基本模型都介绍完了&#xff0c;再来回顾一下&#xff1a; 从左到右模型 &#xff1a;arr[index ...] 从 index 之前的不用考虑&#xff0c;只考虑后面的该如何选择 。范围尝试模型 &#xff1a;思考 [L ,…

架构设计:生产消费模型

1. 引言 在现代软件系统中&#xff0c;处理大量数据和消息是一项重要的任务。生产消费模型作为一种经典的并发模式&#xff0c;在解决数据生产和消费之间的关系上发挥着关键作用。该模型通过有效地管理生产者和消费者之间的通信和数据流动&#xff0c;实现了系统组件之间的解耦…

基于华为atlas的分类模型实战

分类模型选用基于imagenet训练的MobileNetV3模型&#xff0c;分类类别为1000类。 pytorch模型导出为onnx&#xff1a; 修改mobilenetv3.py中网络结构&#xff0c;模型选用MobileNetV3_Small模型&#xff0c;网络输出节点增加softmax层&#xff0c;将原始的return self.linear4…

k8s部署java微服务程序时,关于配置conusl acl token的方法总结

一、背景 java微服务程序使用consul作为服务注册中心&#xff0c;而consul集群本身的访问是需要acl token的&#xff0c;以增强服务调用的安全性。 本文试着总结下&#xff0c;有哪些方法可以配置consul acl token&#xff0c;便于你根据具体的情况选择。 个人认为&#xff…

【mysql 数据库事务】开启事务操作数据库,写入失败后,不回滚,会有问题么? 这里隐藏着大坑,复试,面试时可以镇住面试老师!!!!

建表字段: CREATE TABLE user (id INT(11) NOT NULL AUTO_INCREMENT,nickname VARCHAR(32) NOT NULL COLLATE utf8mb4_general_ci,email VARCHAR(32) NOT NULL COLLATE utf8mb4_general_ci,status SMALLINT(6) UNSIGNED NULL DEFAULT NULL,password VARCHAR(256) NULL DEFAULT…

IP源防攻击IPSG(IP Source Guard)

IP源防攻击IPSG&#xff08;IP Source Guard&#xff09;是一种基于二层接口的源IP地址过滤技术&#xff0c;它能够防止恶意主机伪造合法主机的IP地址来仿冒合法主机&#xff0c;还能确保非授权主机不能通过自己指定IP地址的方式来访问网络或攻击网络。 2.1 IPSG基本原理 绑定…

货运搬家小程序的功能与解决方案

在繁忙的现代生活中&#xff0c;搬家不再是一件简单的事。从物品的整理、打包到运输、卸载&#xff0c;每一个环节都可能让您感到头疼。而一款优秀的货运搬家APP&#xff0c;正是您解决这些搬家难题的得力助手。 那么货运搬家APP需要具备哪些功能呢&#xff1f; 1.注册与登录&…

IOC 和 AOP

IOC 所谓的IOC&#xff08;inversion of control&#xff09;&#xff0c;就是控制反转的意思。何为控制反转&#xff1f; 在传统的程序设计中&#xff0c;应用程序代码通常控制着对象的创建和管理。例如&#xff0c;一个对象需要依赖其他对象&#xff0c;那么它会直接new出来…

气体反应瓶适用光伏光电半导体坚固耐用PFA缓冲瓶

PFA冲击瓶&#xff0c;别名特氟龙缓冲瓶、可溶性聚四氟乙烯气体反应瓶。用于气体、固体或液体间的反应实验&#xff0c;广泛应用于光电、新材料、新能源、半导体、地矿、冶金、核工业等行业。 PFA冲击瓶相对于其他材质的反应瓶&#xff0c;不易碎&#xff0c;使用更加安全&…

大模型推理常见采样策略:Top-k, Top-p, Temperature, Beam Search

在大模型训练好之后&#xff0c;如何对训练好的模型进行解码&#xff08;decode&#xff09;是一个重要问题。 大模型输出过程 大模型根据给定的输入文本&#xff08;比如一个开头或一个问题&#xff09;生成输出文本&#xff08;比如一个答案或一个结尾&#xff09;。为了生…

2024智慧城市革命:人工智能、场景与运营的融合之力

在数字革命的浪潮中&#xff0c;2024年的智慧城市将成为人类社会进步的新地标。 三大关键元素——人工智能、场景应用和精准运营——正在重新塑造城市面貌&#xff0c;构建未来的智慧城市生活图景。 一、人工智能&#xff1a;赋能智慧城市 随着人工智能技术的快速发展&#x…

【无标题】积鼎CFD VirtualFlow:航空及汽车燃油晃动流体仿真计算及试验对比

图1 汽车储液罐内的液体晃动 燃油晃动&#xff0c;作为航空、航海及汽车工业中一个重要的物理现象&#xff0c;一直以来都受到广泛关注。在飞行器、船舶或汽车的运行过程中&#xff0c;由于外部扰动或内部燃料的消耗&#xff0c;油箱内的燃油会产生晃动。这种晃动不仅会影响燃…

如何让线索经营更高效、有转化?(一)

​汽车主机厂和经销商从线索经营的&#xff1a;线索获取、线索清洗、线索转化3个环节入手&#xff0c;做精线索、做强转化。 本篇先介绍第一个环节-线索获取。 线索获取&#xff1a;一个平台管理多个投放平台&#xff0c;用更少成本拿到精准线索 一旦投放渠道变多&#xff0…

【Maven】Maven 基础教程(一):基础介绍、开发环境配置

Maven 基础教程&#xff08;一&#xff09;&#xff1a;基础介绍、开发环境配置 1.Maven 是什么1.1 构建1.2 依赖 2.Maven 开发环境配置2.1 下载安装2.2 指定本地仓库2.3 配置阿里云提供的镜像仓库2.4 配置基础 JDK 版本2.5 配置环境变量 1.Maven 是什么 Maven 是 Apache 软件…