Apache、Nginx和Tomcat-虛擬機器主機

來源:互聯網
上載者:User

1、Apache基於網域名稱虛擬機器主機

<VirtualHost *:80>DocumentRoot 路徑ServerName 網域名稱ServerAlias ucenter.comErrorLog "/logs/網域名稱-error_log"CustomLog "/logs/網域名稱-access_log"</VirtualHost><Directory "路徑"> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all</Directory>

2、Apache基於連接埠虛擬機器主機

listen 8081<VirtualHost *:8081> DocumentRoot "/test" ServerName 192.168.0.200 <Directory "/test/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order Deny,Allow Allow from all</Directory></VirtualHost>

3、Apache虛擬目錄:

Alias /虛擬目錄名/ "/myweb"<Directory "/myweb">Options Indexes MultiViewsAllowOverride NoneOrder allow,denyAllow from all</Directory>

4、HTTP使用者認證訪問

<VirtualHost *:80>DocumentRoot /var/www/html<Directory "/var/www/html"> authtype basic authname "Please input Password" #提示資訊 authuserfile /etc/httpd/.passwd #認證檔案路徑.passwd未隱藏檔案 require user user1 #使用者必須輸入密碼訪問</Directory></VirtualHost>htpasswd -cm /etc/httpd/.passwd user1 #此處密碼與使用者的系統密碼無關service httpd restart

5、Nginx虛擬機器主機

vi /usr/local/nginx/conf/nginx.conf  #載入虛擬機器主機配置include vhost/*.conf;vi /usr/local/nginx/conf/vhost   #建立虛擬機器主機設定檔server {listen 80;server_name www.test.com;index index.html index.htm index.php;root /var/www/test.com;access_log /var/log/test.com.log test.com;}service nginx restart #重啟服務

6、Tomcat虛擬機器主機

tomcat/conf/server.xml添加:<Host name="www.test.com" appBase="/web" unpackWARs="true" autoDeploy="true"xmlValidation="false" xmlNamespaceAware="false"><Context path="/" (虛擬目錄名)docBase=""虛擬目錄路徑) debug=”0” /></Host>


本文出自 “Linux熱門技術” 部落格,請務必保留此出處http://going.blog.51cto.com/7876557/1294258

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.