window下phpstudy的nginx配置虚拟主机

因为很长时间没有配置Apache,虽说知道怎么配置nginx,可是仍是花费了一些时间此次记下来下次直接用php

在其余选项文件菜单中->打开配置文件->选择vhosts-confhtml

nginx的话使用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下打开hostsapache

加入你配置的域名解析到本地的代码例如vim

127.0.0.1 localhost 这个是默认有的 127.0.0.1 www.mycomment.com

 apache的虚拟主机的话代码能够参考ide

复制代码
<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>
复制代码
相关文章
相关标签/搜索