伺服器安裝Linux中安裝 Apache
導讀 | 今天給大家介紹一下 伺服器安裝apache |
軟體準備:
apr-1.5.2.tar.gz httpd-2.4.25.tar.gz mod_ftp-0.9.6-beta.tar.gz apr-iconv-1.2.1.tar.gz pcre-8.40.tar.gz apr-util-1.5.4.tar.gz mod_fcgid-2.3.9.tar.gz
解壓軟體:
tar -zxf apr-1.5.2.tar.gz tar -zxf httpd-2.4.25.tar.gz tar -zxf pcre-8.40.tar.gz tar -zxf apr-util-1.5.4.tar.gz tar -zxf mod_ftp-0.9.6-beta.tar.gz tar -zxf apr-iconv-1.2.1.tar.gz tar -zxf mod_fcgid-2.3.9.tar.gz
檢視:ls
[root@smqq Apache]# ls apr-1.5.2 apr-util-1.5.4.tar.gz mod_fcgid-2.3.9.tar.gz apr-1.5.2.tar.gz httpd-2.4.25 mod_ftp-0.9.6 apr-iconv-1.2.1 httpd-2.4.25.tar.gz mod_ftp-0.9.6-beta.tar.gz apr-iconv-1.2.1.tar.gz install pcre-8.40 apr-util-1.5.4 mod_fcgid-2.3.9 pcre-8.40.tar.gz [root@smqq Apache]#
安裝
apr: [root@smqq Apache]# cd apr-1.5.2 [root@smqq apr-1.5.2]#./configure --prefix=/home/Apache/install/apr [root@smqq apr-1.5.2]#make [root@smqq apr-1.5.2]#make install apr-util: [root@smqq Apache]# cd apr-util-1.5.4 [root@smqq apr-util-1.5.4]#./configure --prefix=/home/Apache/install/apr-util -with-apr=/home/Apache/install/apr/bin/apr-1-config [root@smqq apr-util-1.5.4]#make [root@smqq apr-util-1.5.4]#make install pcre-8.40: [root@smqq Apache]# cd pcre-8.40 [root@smqq pcre-8.40]#./configure --prefix=/home/Apache/install/pcre [root@smqq pcre-8.40]#make [root@smqq pcre-8.40]#make install
下面是apache 的安裝了 可能會出現各種的錯誤,我們一步步來
httpd-2.4.25 : [root@smqq Apache]# cd httpd-2.4.25 [root@smqq httpd-2.4.25]# ./configure --prefix=/home/Apache/install/httpd-2.4.25 checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... no configure: error: APR not found. Please read the documentation. [root@smqq httpd-2.4.25]#
這裡提示說apr 沒有找到,我們之前安裝過了,為什麼?
找下原因:
原來需要新增 with
[root@smqq httpd-2.4.25]# ./configure --prefix=/home/Apache/install/httpd-2.4.25 --with-apr=/home/Apache/install/apr --with-apr-util=/home/Apache/install/apr-util --with-pcre=/home/Apache/install/pcre [root@smqq httpd-2.4.25]#make [root@smqq httpd-2.4.25]#make install
至此安裝的步驟已經完成了,下面啟動啟動測試
•啟動Apache:/home/Apache/install/httpd-2.4.25/bin/apachectl start •停止Apache:/home/Apache/install/httpd-2.4.25/bin/apachectl stop •重啟Apache:/home/Apache/install/httpd-2.4.25/bin/apachectl restart
啟動:
[root@smqq httpd-2.4.25]# /home/Apache/install/httpd-2.4.25/bin/apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message [root@smqq httpd-2.4.25]#
他讓設定一個服務的名稱,我們找到httpd.conf配置一下servername
[root@smqq conf]# vim /home/Apache/install/httpd-2.4.25/conf/httpd.conf [root@smqq conf]#
找到註釋的地方 Servername 修改成你的ip,或者127.0.0.1,或者localhost
ServerName 172.16.3.86:80
再次啟動:
[root@smqq conf]# /home/Apache/install/httpd-2.4.25/bin/apachectl start httpd (pid 57862) already running [root@smqq conf]#
測試一下瀏覽器開啟:
對映靜態檔案
到這裡伺服器搭建成功了,但是我們需要的是一個能夠訪問靜態檔案的伺服器,所以還需要將本地檔案對映到apache伺服器上。
接下來一步步進行對映配置:
找到一個配置,參照這個配置我們從新設定下conf檔案
先停掉服務
[root@smqq conf]# /home/Apache/install/httpd-2.4.25/bin/apachectl stop [root@smqq conf]# vim /home/Apache/install/httpd-2.4.25/conf/httpd.conf
[root@smqq conf]# /home/Apache/install/httpd-2.4.25/bin/apachectl start
原文來自:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69955379/viewspace-2890738/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux伺服器---安裝apacheLinux伺服器Apache
- Linux系統下安裝Apache伺服器LinuxApache伺服器
- linux中安裝JDK linux中安裝Tomcat linux中安裝Mysql 及故障解析 linux系統安裝redisLinuxJDKTomcatMySqlRedis
- linux伺服器安裝字型Linux伺服器
- Linux伺服器—安裝bindLinux伺服器
- Linux伺服器---安裝bindLinux伺服器
- Linux伺服器—安裝mysqlLinux伺服器MySql
- Linux伺服器---安裝mysqlLinux伺服器MySql
- Linux伺服器—安裝TomcatLinux伺服器Tomcat
- Linux伺服器---安裝swatLinux伺服器
- Linux伺服器---安裝sambaLinux伺服器Samba
- Linux伺服器---安裝squidLinux伺服器UI
- Linux伺服器---安裝vsftpdLinux伺服器FTP
- Linux伺服器---安裝jdkLinux伺服器JDK
- Linux伺服器---安裝nfsLinux伺服器NFS
- linux 伺服器安裝 nginxLinux伺服器Nginx
- Linux伺服器—安裝telnetLinux伺服器
- Linux伺服器---安裝telnetLinux伺服器
- linux伺服器安裝nginxLinux伺服器Nginx
- 如何在 Rocky Linux 上安裝 Apache Kafka?LinuxApacheKafka
- Linux環境下Apache ActiveMQ 基本安裝LinuxApacheMQ
- Linux中安裝anacondaLinux
- Linux中安裝RedisLinuxRedis
- Apache伺服器上安裝SSL證書?Apache伺服器
- 3.docker 安裝php Apache伺服器DockerPHPApache伺服器
- Linux安裝解除安裝MySQLLinuxMySql
- linux 安裝yum 安裝phpLinuxPHP
- apache編譯安裝Apache編譯
- Apache Ranger安裝部署ApacheRanger
- mac安裝apache flinkMacApache
- 下載安裝ApacheApache
- Linux中如何安裝RabbitMQ?在linux系統中安裝Rabbitmq的方法LinuxMQ
- linux下Apache+PHP+MySQL安裝配置攻略LinuxApachePHPMySql
- 在linux中安裝DockerLinuxDocker
- Arch Linux中安裝AnacondaLinux
- linux下安裝snap安裝工具Linux
- Linux 解除安裝openjdk 安裝oraclejdkLinuxJDKOracle
- linux 解除安裝jdk和安裝LinuxJDK