zoukankan      html  css  js  c++  java
  • window下phpstudy的nginx配置虚拟主机

    偶尔在网络上面百度了一下怎么在phpstudy里面使用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:WindowsSystem32driversetc下打开hosts

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

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

    apache的虚拟主机的话代码可以参考

    <VirtualHost *:80>
    ServerAdmin fudesign2008@163.com
    DocumentRoot "你网站的路径"
        ServerName editor.fuyg.cn
        ServerAlias editor.fuyg.cn
        ErrorLog "logs/dummy-host.localhost-error.log"
        CustomLog "logs/dummy-host.localhost-access.log" combined
        <Directory "你网站的路径">
            Options Indexes FollowSymLinks
            AllowOverride All 
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
  • 相关阅读:
    hdu6055(求正方形个数)
    树状数组模板(改点求段 / 该段求点 / 改段求段)
    poj2763(lca / RMQ + 线段树)
    poj3728(lca / tarjan离线)
    JDK8-废弃永久代(PermGen)迎来元空间(Metaspace)
    JVM垃圾回收机制
    虚拟机字节码执行引擎
    Java中程序初始化的顺序
    Java中ClassLoader浅析.
    Python中的self
  • 原文地址:https://www.cnblogs.com/depravity/p/9563772.html
Copyright © 2011-2022 走看看