美文网首页
Linux上配置Nginx配置host文件

Linux上配置Nginx配置host文件

作者: 安晓生 | 来源:发表于2020-03-30 11:55 被阅读0次

    不多哔哔,直接代码

    配置文件需要的简单配置:
    
    server {
            listen       80;
            server_name  yourdomain.com;
     
            location / {
                root   /usr/local/nginx/html/yourdomain.com;
                index  index.html index.htm index.php;
                if ( !-e $request_filename ) {
                    rewrite ^/(.*)? /index.php?/$1 last;
                    break;
                }
            }
     
            location ~ \.php$ {
                root /usr/local/nginx/html/yourdomain.com;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }
     
            error_log /www/logs/yourdomain.com_error.log;
            access_log /www/logs/yourdomain.com_access.log main;
    }
    根据自己需要的路径来配置。
    每个人的需求不一样。
    

    相关文章

      网友评论

          本文标题:Linux上配置Nginx配置host文件

          本文链接:https://www.haomeiwen.com/subject/jlomuhtx.html