亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 網站 > Apache > 正文

apache2服務器的搭建和配置步驟詳解

2024-08-27 18:30:42
字體:
來源:轉載
供稿:網友

前言

這篇文章主要給大家介紹了在linux下apache2服務器的搭建和配置的相關資料,具有一定的參考價值,下面來一起學習學習吧。

步驟如下

首先當然是下載包包:

myths@myths-X450LD:~$ sudo apt-get install apache2

裝完后就可以用了,在地址欄輸入本地回送地址127.0.0.1或者localhost就可以進入到默認的界面了。

默認的界面當然就是apache2的說明界面了。其實很多情況下并不需要在網上尋找?guī)椭臋n,幾乎所有的軟件都會自帶使用說明,只是略長,我們一般都懶得看。但是其實很多重要的東西就在這當中,比如apache2的默認界面里:

Ubuntu Logo Apache2 Ubuntu Default PageIt works!This is the default welcome page used to test the correct operation of the Apache2 server after installation on Ubuntu systems. It is based on the equivalent page on Debian, from which the Ubuntu Apache packaging is derived. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server.If you are a normal user of this web site and don't know what this page is about, this probably means that the site is currently unavailable due to maintenance. If the problem persists, please contact the site's administrator.Configuration OverviewUbuntu's Apache2 default configuration is different from the upstream default configuration, and split into several files optimized for interaction with Ubuntu tools. The configuration system is fully documented in /usr/share/doc/apache2/README.Debian.gz. Refer to this for the full documentation. Documentation for the web server itself can be found by accessing the manual if the apache2-doc package was installed on this server.The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows:/etc/apache2/|-- apache2.conf|  `-- ports.conf|-- mods-enabled|  |-- *.load|  `-- *.conf|-- conf-enabled|  `-- *.conf|-- sites-enabled|  `-- *.confapache2.conf is the main configuration file. It puts the pieces together by including all remaining configuration files when starting up the web server.ports.conf is always included from the main configuration file. It is used to determine the listening ports for incoming connections, and this file can be customized anytime.Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/ directories contain particular configuration snippets which manage modules, global configuration fragments, or virtual host configurations, respectively.They are activated by symlinking available configuration files from their respective *-available/ counterparts. These should be managed by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and a2enconf, a2disconf . See their respective man pages for detailed information.The binary is called apache2/. Due to the use of environment variables, in the default configuration, apache2 needs to be started/stopped with /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not work with the default configuration.Document RootsBy default, Ubuntu does not allow access through the web browser to any file apart of those located in /var/www, public_html directories (when enabled) and /usr/share (for web applications). If your site is using a web document root located elsewhere (such as in /srv) you may need to whitelist your document root directory in /etc/apache2/apache2.conf.The default Ubuntu document root is /var/www/html. You can make your own virtual hosts under /var/www. This is different to previous releases which provides better security out of the box.Reporting ProblemsPlease use the ubuntu-bug tool to report bugs in the Apache2 package with Ubuntu. However, check existing bug reports before reporting a new bug.Please report bugs specific to modules (such as PHP and others) to respective packages, not to the web server itself.Valid XHTML 1.0 Transitional

僅僅從這個文件中,我們就可以至少得到以下的重要信息:

  • 當訪問本機的時候,默認進入的頁面是/var/www/html/index.html。
  • 配置系統(tǒng)的說明在/usr/share/doc/apache2/README.Debian.gz中。
  • 完整使用手冊可以通過安裝apache2-doc 進行下載。
  • 主配置文件為/etc/apache2/apache2.conf。
  • 啟動和關閉apache2服務可以通過執(zhí)行命令/etc/init.d/apache2 start(stop / restart)當然也可以是 service apache2 start (stop / restart)。這里一定要注意記得!記得!加root權限!這里不加root權限并沒有明顯的提示(好坑),當遇到問題的時候很難讓人想到是這里出的錯,所以一定要記得!記得!加root權限!
  • 默認情況下apache2拒絕訪問除/var/www 和/usr/share文件夾外的其他文件,這種權限是通過apache2.conf文件來控制的.

默認的apache2.conf為:

# This is the main Apache server configuration file. It contains the# configuration directives that give the server its instructions.# See http://httpd.apache.org/docs/2.4/ for detailed information about# the directives and /usr/share/doc/apache2/README.Debian about Debian specific# hints.### Summary of how the Apache 2 configuration works in Debian:# The Apache 2 web server configuration in Debian is quite different to# upstream's suggested way to configure the web server. This is because Debian's# default Apache2 installation attempts to make adding and removing modules,# virtual hosts, and extra configuration directives as flexible as possible, in# order to make automating the changes and administering the server as easy as# possible.# It is split into several files forming the configuration hierarchy outlined# below, all located in the /etc/apache2/ directory:## /etc/apache2/# |-- apache2.conf# | `-- ports.conf# |-- mods-enabled# | |-- *.load# | `-- *.conf# |-- conf-enabled# | `-- *.conf# `-- sites-enabled# `-- *.conf### * apache2.conf is the main configuration file (this file). It puts the pieces# together by including all remaining configuration files when starting up the# web server.## * ports.conf is always included from the main configuration file. It is# supposed to determine listening ports for incoming connections which can be# customized anytime.## * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/# directories contain particular configuration snippets which manage modules,# global configuration fragments, or virtual host configurations,# respectively.## They are activated by symlinking available configuration files from their# respective *-available/ counterparts. These should be managed by using our# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See# their respective man pages for detailed information.## * The binary is called apache2/. Due to the use of environment variables, in# the default configuration, apache2 needs to be started/stopped with# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not# work with the default configuration.# Global configuration### ServerRoot: The top of the directory tree under which the server's# configuration, error, and log files are kept.## NOTE! If you intend to place this on an NFS (or otherwise network)# mounted filesystem then please read the Mutex documentation (available# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);# you will save yourself a lot of trouble.## Do NOT add a slash at the end of the directory path.##ServerRoot "/etc/apache2"## The accept serialization lock file MUST BE STORED ON A LOCAL DISK.#Mutex file:${APACHE_LOCK_DIR} default## PidFile: The file in which the server should record its process# identification number when it starts.# This needs to be set in /etc/apache2/envvars#PidFile ${APACHE_PID_FILE}## Timeout: The number of seconds before receives and sends time out.#Timeout 300## KeepAlive: Whether or not to allow persistent connections (more than# one request per connection). Set to "Off" to deactivate.#KeepAlive On## MaxKeepAliveRequests: The maximum number of requests to allow# during a persistent connection. Set to 0 to allow an unlimited amount.# We recommend you leave this number high, for maximum performance.#MaxKeepAliveRequests 100## KeepAliveTimeout: Number of seconds to wait for the next request from the# same client on the same connection.#KeepAliveTimeout 5# These need to be set in /etc/apache2/envvarsUser ${APACHE_RUN_USER}Group ${APACHE_RUN_GROUP}## HostnameLookups: Log the names of clients or just their IP addresses# e.g., www.apache.org (on) or 204.62.129.132 (off).# The default is off because it'd be overall better for the net if people# had to knowingly turn this feature on, since enabling it means that# each client request will result in AT LEAST one lookup request to the# nameserver.#HostnameLookups Off# ErrorLog: The location of the error log file.# If you do not specify an ErrorLog directive within a <VirtualHost># container, error messages relating to that virtual host will be# logged here. If you *do* define an error logfile for a <VirtualHost># container, that host's errors will be logged there and not here.#ErrorLog ${APACHE_LOG_DIR}/error.log## LogLevel: Control the severity of messages logged to the error_log.# Available values: trace8, ..., trace1, debug, info, notice, warn,# error, crit, alert, emerg.# It is also possible to configure the log level for particular modules, e.g.# "LogLevel info ssl:warn"#LogLevel warn# Include module configuration:IncludeOptional mods-enabled/*.loadIncludeOptional mods-enabled/*.conf# Include list of ports to listen onInclude ports.conf# Sets the default security model of the Apache2 HTTPD server. It does# not allow access to the root filesystem outside of /usr/share and /var/www.# The former is used by web applications packaged in Debian,# the latter may be used for local directories served by the web server. If# your system is serving content from a sub-directory in /srv you must allow# access here, or in any related virtual host.<Directory /> Options FollowSymLinks AllowOverride None Require all denied</Directory><Directory /usr/share> AllowOverride None Require all granted</Directory><Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted</Directory>#<Directory /srv/># Options Indexes FollowSymLinks# AllowOverride None# Require all granted#</Directory># AccessFileName: The name of the file to look for in each directory# for additional configuration directives. See also the AllowOverride# directive.#AccessFileName .htaccess## The following lines prevent .htaccess and .htpasswd files from being# viewed by Web clients.#<FilesMatch "^.ht"> Require all denied</FilesMatch>## The following directives define some format nicknames for use with# a CustomLog directive.## These deviate from the Common Log Format definitions in that they use %O# (the actual bytes sent including headers) instead of %b (the size of the# requested file), because the latter makes it impossible to detect partial# requests.## Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.# Use mod_remoteip instead.#LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combinedLogFormat "%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combinedLogFormat "%h %l %u %t "%r" %>s %O" commonLogFormat "%{Referer}i -> %U" refererLogFormat "%{User-agent}i" agent# Include of directories ignores editors' and dpkg's backup files,# see README.Debian for details.# Include generic snippets of statementsIncludeOptional conf-enabled/*.conf# Include the virtual host configurations:IncludeOptional sites-enabled/*.conf# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

注意這當中的一段:

<Directory /> Options FollowSymLinks AllowOverride None Require all denied</Directory><Directory /usr/share> AllowOverride None Require all granted</Directory><Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted</Directory>

由這段可以很容易的知道apache2到底為哪些文件夾賦予了打開的權限了。以后就可以通過修改這里達到各種不可告人的目的了。

最后還有一個重要的配置,就是默認目錄的更改。默認的目錄其實是記錄在:/etc/apache2/sites-available/000-default.conf 文件當中(在/etc/apache2/sites-enable/中也有一個指向他的鏈接):

myths@myths-X450LD:/etc/apache2/sites-available$ cat 000-default.conf <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf</VirtualHost># vim: syntax=apache ts=4 sw=4 sts=4 sr noet

當中的“DocumentRoot ”鍵對應的值就是默認的目錄了,可以任由我們修改了。

apache2的簡單配置基本就是這些,不需要百度,我們也是完全可以自己弄清楚的。

注:

  • 修改完配置文件后記得重啟服務
  • 可以順手吧/var/www的權限設置為777方便修改網頁

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對VEVB武林網的支持。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
精品国产欧美日韩不卡在线观看| 欧美在线一区视频| 日韩一区二区三区三四区视频在线观看| 亚洲一区二区三区av无码| 国产免费成人av| av中文字幕在线| 国产丝袜高跟一区| 欧美精品色视频| 一道精品视频一区二区三区男同| 四季av一区二区凹凸精品| 国语对白在线播放| 好久没做在线观看| 黄色网址在线免费| 最新av免费在线| 亚洲欧美怡红院| 一区在线不卡| 国产精品极品美女在线观看免费| 极品一区美女高清| 精品国产视频一区二区三区| 日韩国产欧美一区二区| 1024手机在线观看你懂的| 白浆在线视频| 又色又爽又黄18网站| 9l亚洲国产成人精品一区二三| 成人在线观看免费网站| 51精品国产人成在线观看| 日本欧美加勒比视频| 欧美亚洲国产怡红院影院| 欧美先锋影音| 八戒八戒神马在线电影| 一区二区三区四区五区在线| 爽爽爽爽爽爽爽成人免费观看| 日本不卡免费新一二三区| 一区二区三区四区不卡视频| 免费观影入口看日本视频| 97视频网站入口| 国产亚洲欧美日韩精品一区二区三区| 无码中文字幕色专区| 一区二区三区高清| 欧美黑人又粗又大又爽免费| 欧美成人精品3d动漫h| 国产精品久久久久久网站| 久热这里只有精品6| 午夜国产在线| 亚洲精品555| 精品久久久久久久久久久久包黑料| 久久国产午夜精品理论片最新版本| 免费看日韩毛片| 中文字幕av一区二区三区四区| 99久久人妻无码中文字幕系列| 亚洲日韩中文字幕一区| 国产xxxxxxxxx| 国产中文欧美日韩在线| 黄色网址免费看| 自拍偷拍中文字幕| 精品欧美色视频网站在线观看| 国产精品传媒精东影业在线| 全彩无遮挡全彩口工漫画h#| 亚洲欧美久久久久一区二区三区| 一个色在线视频| 久久亚洲一区二区三区明星换脸| 国产一区二区精品福利地址| 99精品中文字幕在线不卡| 一本一本久久a久久精品牛牛影视| 成年人在线看| 亚洲人成精品久久久久久| www..69.hd| 亚洲视频在线网| 亚洲免费久久| 警花av一区二区三区| 亚洲精品国产精品乱码视色| 香蕉大人久久国产成人av| 国产精品成人观看视频国产奇米| 亚洲精品怡红院| 在线黄色免费网站| 国产精彩视频在线观看免费蜜芽| 国产精品s色| 国产福利91精品一区| 国产在线一区二区三区欧美| 一区二区视频在线播放| 成人午夜精品| 国产欧美大片| 久久伦理中文字幕| 91久久国产综合久久| 日韩精品免费一区二区| 亚洲天堂av网站| 免费涩涩18网站入口| 男人艹女人在线观看| 最新视频 - x88av| 欧美高清电影在线看| 三级影片在线观看欧美日韩一区二区| 一区二区三区日韩欧美| 97精品在线视频| 忘忧草精品久久久久久久高清| 国产成人视屏| 免费国产黄色网址| 国产素人视频在线观看| 国产99一区视频免费| 亚洲资源中文字幕| 成人羞羞网站入口免费| 久热久热免费视频中文字幕777| 成人禁用看黄a在线| 久久免费的精品国产v∧| 亚洲视频在线免费播放| 老师让我她我爽了好久视频| 最近高清中文在线字幕在线观看| 午夜电影亚洲| 日韩精品影音先锋| 成人a'v在线播放| 国产精品亚洲综合天堂夜夜| 免费一级做a爰片久久毛片潮| 免费看成人哺乳视频网站| eeuss影院网站免费观看| 色综合亚洲欧洲| 亚洲色欲久久久综合网东京热| 亚洲一区二区三区四区在线| 国产尤物99| 国产又黄又爽免费视频| 精品一区二区三区免费视频| 亚洲精品一区二区三区网址| 亚洲高清不卡在线观看| 精品96久久久久久中文字幕无| 日本午夜激情视频| 鲁丝一区二区三区免费| 男男电影完整版在线观看| 国产不卡av在线免费观看| 99re这里只有精品6| 麻豆一区二区三区| 亚洲av色香蕉一区二区三区| 青青国产精品| 日韩视频www| 中日韩av电影| 韩日成人在线| 日韩av三区| 日韩在线观看高清| 92看片淫黄大片一级| 久久综合色播| 大伊人狠狠躁夜夜躁av一区| 丰满人妻一区二区三区免费视频棣| 91无套直看片红桃在线观看| 人妻 日韩 欧美 综合 制服| 日韩有码一区| 成人网址在线观看| 欧美gay囗交囗交| 免费黄色在线网址| 国产免费一区二区三区最新不卡| 在线成人视屏| 亚洲人成网站精品片在线观看| 狠狠狠色丁香婷婷综合久久五月| 欧美巨大另类极品videosbest| 日本成人网址| 不卡视频免费在线观看| 亚洲综合视频在线播放| 中文字幕在线观看一区二区| 欧美一级在线视频| 中文字幕一区二区三区免费看| 国产精品久久久久野外| 成网站在线观看人免费| 亚洲午夜久久久久久尤物| 爱福利视频一区二区| 国产精品久久精品日日| 丰满少妇高潮久久三区| 警花观音坐莲激情销魂小说| 中文字幕无线码一区| 久久精品高清| 波多野结衣 久久| 国产66精品| 亚洲一区二区av在线| 日本午夜免费一区二区| 亚洲综合色自拍一区| 国产精品高清一区二区三区| 亚洲精品一区二区妖精| 中文字幕日本精品| 国产农村妇女毛片精品| 男女交配网站| 日韩一区二区不卡视频| 9色在线视频网站| 欧美一级片免费播放| 99精品国产99久久久久久福利| 成人性生交大免费看| 国产又粗又长又硬| 日本一区二区三区在线观看| 久久国内精品自在自线400部| 中文字幕网av| 99精彩视频在线观看免费| 久久久久久久久久一区二区三区| 日本黄xxxxxxxxx100| www欧美在线观看| 亚洲精品国产偷自在线观看| 精品国产一区一区二区三亚瑟| www.天堂乱色| 国模视频一区| 国产美女裸体无遮挡免费视频| jizzjizzjizz亚洲女| 国产精品美女主播在线观看纯欲| 欧美国产综合一区二区| 久久久久久久久久毛片| 国产欧美日韩精品丝袜高跟鞋| 亚洲永久精品ww.7491进入| 91成人短视频| 写真福利片hd在线播放| 15—17女人毛片| 国产高清无密码一区二区三区| 亚洲在线不卡| 在线观看黄色av网站| 亚洲wwwwww| 日本久久一区二区| 99久久久无码国产精品性色戒| 97电影在线看视频| 国产精品久久久久久久久久| 精品一区二区三区日韩| 成人在线免费看视频| 国产精品一区久久久| 欧美视频一区二| 欧美在线免费观看亚洲| 亚洲乱码中文字幕综合| 教室别恋欧美无删减版| gogo高清午夜人体在线| 欧美成人三级在线观看| 国产精品大片免费观看| 日韩美女激情视频| 国产精品一区二区99| 天堂一区二区在线| 国产精品电影一区二区| 国产成人av电影在线观看| 日本一道高清一区二区三区| 亚洲欧洲制服丝袜| 国内精品久久久久久影院老狼| 久久久在线视频| 四虎精品成人免费观看| 国产成人精品亚洲日本在线观看| 欧美三级电影一区| 欧美黄网站在线观看| 中文字幕无码不卡免费视频| 在线观看中文字幕| 九九精品视频在线看| 第一次破处视频| 2019亚洲男人天堂| 国产99在线|中文| 97超碰人人看人人| 精品三级在线看| av在线免费观看国产| 中文字幕一区二区三区乱码在线| 精品无码三级在线观看视频| 免费国产a级片| 99蜜月精品久久91| 午夜精品视频在线观看一区二区| 国产一级二级三级| 粉嫩嫩av羞羞动漫久久久| 欧洲金发美女大战黑人| 久久精品视频6| 久久久一二三区| 成人av免费电影网站| 91免费版在线看| 亚洲欧美日韩国产综合| 亚洲手机成人高清视频| 91高清在线观看视频| 新版中文字幕在线资源| 一区二区三区欧美亚洲| 99久久夜色精品国产亚洲| 亚洲国产成人无码av在线| av手机免费在线观看| 自拍偷拍第9页| 午夜激情久久久| 伊人久久综合网另类网站| www.8ⅹ8ⅹ羞羞漫画在线看| 亚洲自拍偷拍精品| 国产伦精品一区二区三区在线播放| 中文字幕在线播放av| 欧美videos另类| 午夜娱乐在线| 国产特级毛片| 青青草视频在线免费直播| 天天躁夜夜躁狠狠是什么心态| 九色porny自拍| 国产视频一区二区三区在线播放| 欧美 日韩 中文字幕| 久久电影网电视剧免费观看| 香蕉视频在线网址| 国产成人精品一区二区免费视频| 午夜天堂精品久久久久| 岛国片av在线| 久久影院亚洲| 91精品国产亚洲| 成人欧美视频在线观看播放| 免费一级片在线观看| 国产欧美精品一区二区三区四区| 欧美精品一区二区在线观看| 在线播放av更多| 成av人电影在线观看| 桃花视频大全不卡免费观看网站| 美女又黄又免费的视频| www免费在线观看视频| 羞羞视频在线免费国产| 国产 福利 在线| 国产亚洲视频一区| 国产精品亚洲天堂| 日韩精品成人免费观看视频| 成人黄色理论片| 欧美一区午夜精品| 欧美成人乱码一区二区三区| 在线精品视频视频中文字幕| 丝瓜app色版网站观看| 污版网站在线观看| 丰满人妻av一区二区三区| 最新国产精品亚洲| 黄色av一区二区| 又色又爽又高潮免费视频国产| 国产女人18毛片水真多| 亚洲av永久无码精品| 日韩精品久久久久久久的张开腿让| 在线观看国产精品淫| 在线精品视频视频中文字幕| 无人码人妻一区二区三区免费| 欧美国产精品中文字幕| 国产内射老熟女aaaa| 国产亚洲欧洲一区高清在线观看| 精品一区二区三区蜜桃在线| 黄色小视频免费在线观看| 成人资源av| 欧美猛交ⅹxxx乱大交视频| 欧美黑人性猛交xxx| 欧美日韩在线中文字幕| 欧美午夜精品理论片| 天天射天天综合网| 久久久久人妻一区精品色| 久精品免费视频| 久久精品一区中文字幕|