2010-08-04 166 views
1

我爲可以正常工作的Web應用程序製作了Apache虛擬主機,但是我遇到了URL的問題。我希望我的應用程序只能使用類似於:http://ip_address/app_name的網址進行訪問,但現在可以通過http://ip_address/訪問該應用程序。Apache虛擬主機URL

我的虛擬主機是這樣的:

NameVirtualHost 192.168.5.235:80 

<VirtualHost 192.168.5.235:80> 
    ServerName 192.168.5.235 
    Alias /ksw "/home/ksw/site" 
    DocumentRoot "/home/ksw/site/" 
    ErrorLog /home/ksw/logs/error_log 
    CustomLog /home/ksw/logs/access_log combined 
</VirtualHost> 

是否有配置我的應用程序的方式來訪問僅使用http://ip_adress/app_name?謝謝。

家庭/家庭/ KSW /網站文件是:

drwxrwxr-x 18 apache apache 4096 Aug 4 17:41 . 
drwxr-xr-x 4 root root  4096 Aug 3 20:17 .. 
-rw-rw-r-- 1 apache apache 825 Aug 3 20:18 AdminSettings.sample 
-rw-rw-r-- 1 apache apache 2179 Aug 3 20:18 api.php 
-rw-rw-r-- 1 apache apache  28 Aug 3 20:18 api.php5 
drwxrwxr-x 2 apache apache 4096 Aug 3 20:17 bin 
drwxrwxr-x 2 apache apache 4096 Aug 3 20:18 config 
-rw-rw-r-- 1 apache apache 4505 Aug 3 20:18 config.php 
-rw-rw-r-- 1 apache apache 17997 Aug 3 20:17 COPYING 
drwxrwxr-x 4 apache apache 4096 Aug 3 20:18 docs 
drwxrwxr-x 3 apache apache 4096 Aug 3 20:17 extensions 
-rw-rw-r-- 1 apache apache 162 Aug 3 20:18 FAQ 
-rw-rw-r-- 1 apache apache 236945 Aug 3 20:17 HISTORY 
drwxrwxr-x 2 apache apache 4096 Aug 3 20:18 home 
drwxrwxrwx 3 apache apache 4096 Aug 3 20:17 images 
-rw-rw-r-- 1 apache apache 2474 Aug 3 20:18 img_auth.php 
-rw-rw-r-- 1 apache apache  35 Aug 3 20:17 img_auth.php5 
drwxrwxr-x 9 apache apache 12288 Aug 4 14:13 includes 
-rw-rw-r-- 1 apache apache 4561 Aug 3 21:03 index.php 
-rw-rw-r-- 1 apache apache  32 Aug 3 20:17 index.php5 
-rw-rw-r-- 1 apache apache 3992 Aug 3 20:17 INSTALL 
-rw-rw-r-- 1 apache apache 3772 Aug 3 20:18 install-utils.inc 
drwxrwxr-x 4 apache apache 4096 Aug 3 20:18 languages 
drwxrwxr-x 2 apache apache 4096 Aug 3 20:17 locale 
-rw-rw-r-- 1 apache apache 4993 Aug 4 14:05 LocalSettings.php 
drwxrwxr-x 8 apache apache 4096 Aug 3 20:18 maintenance 
-rw-rw-r-- 1 apache apache 569 Aug 3 20:18 Makefile 
drwxrwxr-x 2 apache apache 4096 Aug 3 20:17 math 
-rw-rw-r-- 1 apache apache 1532 Aug 3 20:18 opensearch_desc.php 
-rw-rw-r-- 1 apache apache 6173 Aug 3 20:18 profileinfo.php 
-rw-rw-r-- 1 apache apache 3535 Aug 3 20:18 README 
-rw-rw-r-- 1 apache apache 299 Aug 4 17:41 redirect.php 
-rw-rw-r-- 1 apache apache  35 Aug 3 20:17 redirect.php5 
-rw-rw-r-- 1 apache apache  91 Aug 3 20:17 redirect.phtml 
-rw-rw-r-- 1 apache apache 34280 Aug 3 20:17 RELEASE-NOTES 
drwxrwxr-x 2 apache apache 4096 Aug 3 20:17 serialized 
-rw-rw-r-- 1 apache apache 18814 Aug 3 20:18 setup.php 
-rw-rw-r-- 1 apache apache 20480 Aug 3 20:18 .setup.php.swp 
drwxrwxr-x 9 apache apache 4096 Aug 3 20:18 skins 
-rw-rw-r-- 1 apache apache 603 Aug 3 20:18 StartProfiler.php 
drwxrwxr-x 4 apache apache 4096 Aug 3 20:17 t 
-rw-rw-r-- 1 apache apache 12822 Aug 3 20:18 Test.php 
drwxrwxr-x 2 apache apache 4096 Aug 3 20:18 tests 
-rw-rw-r-- 1 apache apache 2746 Aug 3 20:18 thumb.php 
-rw-rw-r-- 1 apache apache  32 Aug 3 20:18 thumb.php5 
-rw-rw-r-- 1 apache apache 1373 Aug 3 20:18 trackback.php 
-rw-rw-r-- 1 apache apache 13195 Aug 3 20:18 UPGRADE 
drwxrwxr-x 16 apache apache 4096 Aug 3 20:18 wiki 
-rw-rw-r-- 1 apache apache  88 Aug 3 20:17 wiki.phtml 
-rw-rw-r-- 1 apache apache 3830 Aug 3 20:18 xmlp4.php 

回答

1

船長明顯的說,它不應該是這樣的。 =)
僅當'app_name'dir是'ip_addr'dir的符號鏈接時纔可以。
或者如果你使用django(例如)並且錯誤地配置了視圖。
你使用php嗎?如果是這樣的 - 這是絕對錯誤發生=)


補充說:
如果「APP_NAME」字符串實際上是「KSW」比...
你已經安裝在你的網站根目錄MEDIAWIKI和ONLY通過'Alias/ksw'添加了一個鏈接!
解決方案:

  • 如果只想限制訪問http://ip_address/使用的.htaccess文件的Apache。
  • 如果你想在/和/ app_name有2個不同的頁面,你需要創建文件夾'app_name'並在那裏安裝你的應用程序!

就是這樣。

+0

是的我使用php。它實際上是我嘗試使其工作的一個MediaWiki版本。 – Madalina 2010-08-04 08:23:16

+0

站點根目錄中的文件(/ home/ksw/site /)是什麼?請列出'ls -la'列表。 而我認爲的主要問題=)...你有什麼,而不是'app_name'?那是'ksw'嗎? – Sergey 2010-08-05 04:54:16

+0

是的app_name是'ksw'。我用清單更新了我的問題。謝謝。 – Madalina 2010-08-05 09:03:42