window下phpstudy的nginx配置虚拟主机

window下phpstudy的nginx配置虚拟主机

由于很长时间没有配置Apache,虽然说知道怎么配置nginx,但是还是花费了一些时间这次记下来下次直接用

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

window下phpstudy的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下打开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>

 以下为亲测有效:

<VirtualHost _default_:80>
DocumentRoot "D:\phpstudy\PHPTutorial\WWW"
  <Directory "D:\phpstudy\PHPTutorial\WWW">
    Options -Indexes -FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin hzym.com
DocumentRoot "D:\phpstudy\PHPTutorial\WWW\welltrend\www"
    ServerName hzym.com
    ServerAlias hzym.com
    ErrorLog "logs/dummy-host.localhost-error.log"
    CustomLog "logs/dummy-host.localhost-access.log" combined
    <Directory "D:\phpstudy\PHPTutorial\WWW\welltrend\www">
        Options Indexes FollowSymLinks
        AllowOverride All 
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

window下phpstudy的nginx配置虚拟主机

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/113587.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Windows Azure Platform Introduction (3) 云计算的特点

    Windows Azure Platform Introduction (3) 云计算的特点

    2022年3月2日
    31
  • Linux下修改Mysql密码的多种方式「建议收藏」

    Linux下修改Mysql密码的多种方式「建议收藏」有时我们会忘记Mysql的密码,或者想改一个密码,以下将对这两种情况修改密码的三种解决方法做个总结本文都以用户为root为例;一、拥有原来的myql的root的密码;方法一:在mysql系统外,使用mysqladminmysqladmin-uroot-ppassword”test123″Enterpassword:【输入原来的密码】方法二:通过登录mysql系统,mysq

    2022年5月27日
    35
  • Spring的contextConfigLocation

    Spring的contextConfigLocationspring如何使用多个xml配置文件1,在web.xml中定义contextConfigLocation参数.spring会使用这个参数加载.所有逗号分割的xml.如果没有这个参数,spring默认加载web-inf/applicationContext.xml文件.例如:<context-param><param-name>conte…

    2022年7月14日
    14
  • sql怎么调用存储过程_oracle sql分页查询

    sql怎么调用存储过程_oracle sql分页查询数据库用的是Oracle,Mybatis自动封装的分页,sql语句在PLSQL中执行没有问题,放在代码里面运行的时候就报错:未明确定义列。通过log打印的sql语句拷出来执行,发现嵌套上分页就会报错。问题原因:sql语句中有个列的别名重复,导致嵌套了分页后,数据库不能确定我们要的到底是哪个列,就会报未明确定义列。网上还有网友说的其他原因大家可以参考,比如

    2022年9月28日
    5
  • JS隐式转换_隐式转换是什么

    JS隐式转换_隐式转换是什么在什么条件下会触发隐式转换机制?在进行比较运算,或者进行四则运算时,常常会触发JS中的隐式转换机制。首先要记住JS设计者的初衷是美好的,他希望==是美好的操作选择,但是在美好的希望也是希望。小案例为什么[]==false?类型不同比较时,需要先做类型转换,==比较时有布尔值参与时,需要比较双方均转为数字,[]是非原值,需要转换为原值二者才能进行比较,大部分对象转换为…

    2022年10月11日
    5
  • java StringTokenizer

    java StringTokenizerStringTokenizer是一个用来分隔String的应用类,相当于VB的split函数。1.构造函数publicStringTokenizer(Stringstr)publicStringTokenizer(Stringstr,Stringdelim)publicStringTokenizer(Stringstr,Stringdelim,boolean

    2022年8月11日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号