由於很長時間沒有配置Apache,雖然說知道怎么配置nginx,但是還是花費了一些時間這次記下來下次直接用
在其他選項文件菜單中->打開配置文件->選擇vhosts-conf
nginx的話使用
server {
listen 80; server_name 你的虛擬目錄名稱; root "你要操作的目錄路徑"; location / { index index.html index.htm index.php; #autoindex on; if ($request_filename !~ (static|robots/.txt|index/.php.*)) { rewrite ^/(.*)$ /index.php?$1 last; break; } } location ~ \.php(.*)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } }
之后最重要一點就是DNS解析了:在C:\Windows\System32\drivers\etc下打開hosts
加入你配置的域名解析到本地的代碼例如
127.0.0.1 localhost 這個是默認有的 127.0.0.1 www.mycomment.com
apache的虛擬主機的話代碼可以參考
<VirtualHost *:80> ServerAdmin fudesign2008@163.com DocumentRoot "F:\workspace\vim\YNote\src" ServerName editor.fuyg.cn ServerAlias editor.fuyg.cn ErrorLog "logs/dummy-host.localhost-error.log" CustomLog "logs/dummy-host.localhost-access.log" combined <Directory "F:\workspace\vim\YNote\src"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>