nginx下配置虚拟主机
linux 虚拟机下配置虚拟主机
nginx.conf 文件不动, 在 conf.d 或者 conf 目录下 新建项目.conf
server {
        listen 80;
        server_name localhost;
        root /var/www/html/device/; #项目的根目录
        index index.php index.html index.htm; #默认寻找的文件
        # 找不到的文件就转到index.php
        if (!-e $request_filename) {
            rewrite ^.*$ /index.php last;
        }
        location ~ \.php($|/) {
            fastcgi_pass 127.0.0.1:9000;#监听9000端口
            include fastcgi_params;
            # 脚本文件请求的路径
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
        location ~ /\.ht {
            deny  all;
        }
    }
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号