成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

如何查看linux下apache配置文件-創(chuàng)新互聯(lián)

這篇文章主要介紹如何查看linux下apache配置文件,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

成都創(chuàng)新互聯(lián)公司專注于營(yíng)山企業(yè)網(wǎng)站建設(shè),自適應(yīng)網(wǎng)站建設(shè),商城網(wǎng)站建設(shè)。營(yíng)山網(wǎng)站建設(shè)公司,為營(yíng)山等地區(qū)提供建站服務(wù)。全流程按需求定制設(shè)計(jì),專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)

Linux下Apache的配置文件是 /etc/apache2/apache2.conf,Apache在啟動(dòng)時(shí)會(huì)自動(dòng)讀取這個(gè)文件的配置信息。而其他的一些配置文件,如 httpd.conf等,則是通過(guò)Include指令包含進(jìn)來(lái)。

在apache2.conf里有sites-enabled目錄,而在 /etc/apache2下還有一個(gè)sites-available目錄,其實(shí),這里面才是真正的配置文件,而sites- enabled目錄存放的只是一些指向這里的文件的符號(hào)鏈接,你可以用ls /etc/apache2/sites-enabled/來(lái)證實(shí)一下。

所以,如果apache上配置了多個(gè)虛擬主機(jī),每個(gè)虛擬主機(jī)的配置文件都放在 sites-available下,那么對(duì)于虛擬主機(jī)的停用、啟用就非常方便了:當(dāng)在sites-enabled下建立一個(gè)指向某個(gè)虛擬主機(jī)配置文件的鏈 接時(shí),就啟用了它;如果要關(guān)閉某個(gè)虛擬主機(jī)的話,只需刪除相應(yīng)的鏈接即可,根本不用去改配置文件。

sudo cp /etc/apache2/sites-avaliable/000-default.conf , 命名為 test.conf

2.修改配置文件:test.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.test.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/test/
ErrorLog /var/www/html/test/error.log
CustomLog /var/www/html/test/access.log combined
<Directory "/var/www/html/test">
    Options FollowSymLinks
    DirectoryIndex index.php index.html index.htm
    AllowOverride All #注意這個(gè)地方的配置,會(huì)影響本地目錄下的.htaccess的啟用
    Order deny,allow
    Allow from All
</Directory>
# 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
# 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>

建立鏈接文件:

sudo ln -s /etc/apache2/sites-available/test.conf /etc/apache2/sites-enabled/test.conf

或者: sudo a2ensite test.conf

4.重啟apache 服務(wù)器

sudo /etc/init.d/apache2 restart

修改hosts(/etc/hosts)

// 增加一行
127.0.0.1 www.test.com

到這里基本就可正常訪問(wèn)了!

附:如果這里還需要對(duì)目錄級(jí)的URL重寫(xiě)支持,繼續(xù)往下:

終端運(yùn)行

sudo a2enmod

程序提示可供激活的模塊名稱,輸入:rewrite

成功會(huì)提示

rewrite already load

修改/etc/apache2/sites-enabled/test.conf (該鏈接指向的是站點(diǎn)配置文件)

把下的AllowOverride 屬性改為All,保存。(上面我們已經(jīng)配置為 All)

重新加載apache

sudo /etc/init.d/apache2 restart

以上是如何查看linux下apache配置文件的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司行業(yè)資訊頻道!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

當(dāng)前文章:如何查看linux下apache配置文件-創(chuàng)新互聯(lián)
URL鏈接:http://jinyejixie.com/article16/jsigg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、App開(kāi)發(fā)、搜索引擎優(yōu)化、ChatGPT、網(wǎng)站策劃、定制網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
房产| 太谷县| 嘉兴市| 十堰市| 河源市| 汉中市| 永修县| 绍兴县| 东源县| 铁力市| 赤城县| 庆城县| 金华市| 横山县| 庆元县| 威宁| 临朐县| 莫力| 云和县| 息烽县| 东台市| 洪雅县| 铜川市| 仙游县| 万源市| 钦州市| 华坪县| 迁安市| 宝山区| 齐齐哈尔市| 神木县| 左贡县| 南汇区| 临猗县| 玉树县| 宁河县| 元江| 和政县| 金昌市| 丹江口市| 思南县|