Integrated
  • Introduction
  • FTP伺服器架設
  • PHP-json格式的轉換
  • Google API
  • Meta Tag
  • 虛擬網址的設定
Powered by GitBook
On this page

Was this helpful?

虛擬網址的設定

虛擬網址設定方法

1.到C:\Windows\System32\drivers\etc\hosts

新增一127.0.0.1 跟自己想設定的網址

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#    ::1             localhost

103.16.120.95 phpadmin.bbinpartner.com
103.16.120.95 art.bbinpartner.com
127.0.0.1     web.rentsearch.com
127.0.0.1     web.webbbin.com

開啟 httpd-vhosts.conf 檔

請各位開啟文字編輯器 ( 例如 NotesPad++ ) 開啟在 XAMPP 安裝資料夾的 xampp\apache\conf\extra\httpd-vhosts.conf 檔。

2.新增 Virtual Host 設定

第一個設定是要維持xampp本機的運作

將設定值貼到 httpd-vhosts.conf 檔的最下方,並依照附註說明做調整。

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
    ##ServerName dummy-host.example.com
    ##ServerAlias www.dummy-host.example.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "C:/xampp/htdocs/laravel/rentSearch/public"
  ServerName web.rentsearch.com
  ErrorLog "logs/web.rentsearch.com-error.log"
  CustomLog "logs/web.rentsearch.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
  DocumentRoot "C:/xampp/htdocs/laravel/webbbin/public"
  ServerName web.webbbin.com
  ErrorLog "logs/web.webbbin.com-error.log"
  CustomLog "logs/web.webbbin.com-access.log" common
</VirtualHost>

這樣就可以用你設定的server name做url進入你的網站了

PreviousMeta Tag

Last updated 5 years ago

Was this helpful?

參考網址