在Rocky Linux中部署LAMP环境,我们需要安装Apache、MySQL和PHP,以下是详细的步骤:
(图片来源网络,侵删)
1、安装Apache
我们需要更新系统软件包,在终端中输入以下命令:
sudo dnf update y接下来,我们安装Apache,在终端中输入以下命令:
sudo dnf install httpd y安装完成后,启动Apache服务并设置为开机自启动:
sudo systemctl start httpd sudo systemctl enable httpd2、安装MySQL
我们需要添加MySQL的官方仓库,在终端中输入以下命令:
sudo dnf configmanager addrepo=https://dev.mysql.com/get/mysql80communityreleaseel83.noarch.rpm接下来,我们安装MySQL,在终端中输入以下命令:
sudo dnf install mysqlcommunityserver y安装完成后,启动MySQL服务并设置为开机自启动:
sudo systemctl start mysqld sudo systemctl enable mysqld3、安装PHP
我们需要安装EPEL(Extra Packages for Enterprise Linux)仓库,在终端中输入以下命令:
sudo dnf install epelrelease y接下来,我们安装PHP及其扩展,在终端中输入以下命令:
sudo dnf install php phpmysqlnd phpfpm phpmbstring phpgd phpxml phppear phpzip y4、配置Apache以支持PHP
编辑Apache的配置文件httpd.conf,启用PHP模块:
sudo vi /etc/httpd/conf.d/php.conf将以下内容添加到文件中:
LoadModule php7_module modules/libphp7.so AddType application/xhttpdphp .php DirectoryIndex index.html index.htm index.php index.php3 index.phtml index.cgi index.shtml index.pl index.jsp index.jspx index.xml index.xsl index.wdt index.phar index.ajx index.ssi index.fcgi index.shtm index.bml index.tml index.tml.html index.tml.htm index.tml.phtml index.tml.php3 index.tml.shtml index.tml.cgi index.tml.jsp index.tml.jspx index.tml.xml index.tml.xsl index.tml.wdt index.tml.phar index.tml.ajx index.tml.ssi index.tml.fcgi index.tml2index.html index.tml2index.htm index.tml2index.php3 index.tml2index.phtml index.tml2index.cgi index.tml2index.jsp index.tml2index.jspx index.tml2index.xml index.tml2index.xsl index.tml2index.wdt index.tml2index.phar index.tml2index.ajx index.tml2index.ssi index.tml2index.fcgi mod_rewrite_test_page_vhost_aliasing_enabled_hint_enforcement_htaccess_check_disabled_value_forbidden_htaccess_check_disabled_value_allowed_htaccess_check_disabled_value no_script no_scanner no_proxy no_proxy_connect no_cache no_store no_transform no_imagemap ajp13 ajp13_sendredirect ajp13_postbuffering ajp13_requesttimeout ajp13_headertimeout ajp13_maxpollinterval ajp13_chunksize ajp13_receivertimeout ajp13_sendtimeout ajp13_keepalivetimeout ajp13_maxkeepaliverequests ajp13_postbuffersize ajp13_maxbuffersize ajp13_enablebetterperformance ajp13_enableresponsesplitting ajp13_preferchunkedencoding ajp13_usesendfile ajp13_suppressexceptionmessages ajp13_loglevel ajp13_logger ajp13_recvheadertimeout ajp13_recvtimeout ajp13_sendfailtimeout ajp13_connectiontimeout ajp13_tomcatauthentication ajp13_tomcatauthtype ajp13_tomcatprincipal tomcatAuthenticationProvider tomcatAuthenticationRealm tomcatPrincipalRegexp tomcatUserDatabase tomcatGroupDatabase tomcatContextPathSecure tomcatStrictRemoteIPHeader tomcatXPoweredBy tomcatAccessFileMaxAge tomcatManagerSessionTimeout tomcatConnectorURIEncoding tomcatMaxKeepAliveRequests tomcatMinSpareThreads tomcatMaxSpareThreads tomcatThreadPool minProcessors maxProcessors threadPriority keepAliveTimeout connectionTimeout serverLimit serverKillInterval connectTimeout clientAuth scheme schemeRegistry port address headerSize keySize vhostOptions tcpNoDelay nodelay acceptCount acceptWindowSize sendfile sizeofsocket bufferSize soTimeout logLevel logFormat logTimeZone logLocale compression disableUploadTimeout useSendfile On ignoreInternalTokens allowLinking allowEncodedSlashes unixUser group unixGroup secureRandomSeed secureRandomAlgorithm openFileCacheTimeout maxKeepAliveRequestsCrawlDelay maxKeepAliveRequestsJKMount mount specVersion useBodyEncodingForURIEscape useCanonicalParsing useFoldingAtStartup useSendLeniently useTcpNoDelay cgi binPath cgiParameters cgiEnvironmentVariables cgiExtendedEnvironmentVariables userDir publicHtmlErrorLog infoLog accessLog formatPrefixAgent readTimeout agentSocket readInterval agentConnectTimeout agentFds openFileCache maxClients maxRequestWorkers maxThreads minSpareThreads threadStack size threadCacheSize threadPriority defaultType defaultHost defaultRedirect nullByteParseIgnoreOrder allowNullChar escapeURLDecoder onPrepareResponse setHandler javaBridgeOutputToServer javaBridgeErrorReporting javaBridgeThrowExceptions javaBridgeServletClass orgWWWProperties securityEnabled securityConstraints securityRoles securityAuthenticators securityManager workManager maxSwallowSize connectionUploadTimeout disableUploadTimeout requestHeaderSize largeUploadThreshold clientMaxBodySize serverMaxBodySize requestSizeLimit postReadSize limit address spaceChecking fileMonitoring checkModifiedOnDisk enableLookups allErrorsIgnored allErrorsFatal onlyOnErrorStatuses statusOnError onPrepare onStartup onShutdown onIdleStateChange onLoad onUnload onManagedRestart onReload onCheckAllTasks onCheckTask onComplete onStop onDestroy onStartupError onShutdownError onIdleStateChangeError onLoadError onUnloadError onManagedRestartError onReloadError onCheckAllTasksError onCheckTaskError onCompleteError onStopError onDestroyError errorSendTracing dumpStdErr dumpStdOut dumpJavaObj loadModule loadModuleStatus unpackWAR unpackWARLocation unpackWARAllowMultiLayer allowLinkingJar checkModifiedOnDiskPeriodic checkModifiedOnDiskInterval checkModifiedOnDiskDir context welcomeFileList directoryIndex disabled welcomeFiles accessFilename allowOverride None order deny from all