开发者社区> 问答> 正文

刚编译的 nginx-1.4.4 启动时就出错? 400 报错

刚编译的 nginx-1.4.4 启动时就出错? 400 报错

刚编译的 nginx-1.4.4 默认的nginx.conf配置文件修改了user选项和网站根目录启动时就出错,问题如下

错误提示 nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/mime.types:1300

不知有没有人知道这什么问题


展开
收起
爱吃鱼的程序员 2020-05-31 00:33:57 726 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    按照错误提示检查 mime.types 文件呗

    ######回复 @KB325688 : 错误不一定是在 1300 行,反正少了一个“}”######回复 @KB325688 : 你可以用 nginx -t 命令来测试配置文件######我查了一下,1300行是mime.types文件的末尾 x-epoc/x-sisx-app sisx,也没什么问题啊###### @红薯 我照你说的测试了一下,结果测试提示失败,纠结。。这个是我的配置文件,也没看出哪里有错啊。
    user  www www;
    worker_processes  2;

    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;

    pid        logs/nginx.pid;


    events {
        worker_connections  1024;
    }


    http {
        include       mime.types;
        default_type  application/octet-stream;

        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';

        #access_log  logs/access.log  main;

        sendfile        on;
        #tcp_nopush     on;

        #keepalive_timeout  0;
        keepalive_timeout  65;

        #gzip  on;

        server {
            listen       80;
            server_name  localhost;

            charset utf-8;

            access_log off;

            location / {
                root   /data/www;
                index  index.php index.html index.htm;
            }

            error_page  404              /404.html;

            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }

            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://127.0.0.1;
            #}

            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            location ~ \.php$ {
                root           /data/www;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }

            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #    deny  all;
            #}
        }


        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;

        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}


        # HTTPS server
        #
        #server {
        #    listen       443;
        #    server_name  localhost;

        #    ssl                  on;
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;

        #    ssl_session_timeout  5m;

        #    ssl_protocols  SSLv2 SSLv3 TLSv1;
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers   on;

        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}

    }
    ######

    大括号数量不匹配,少了一个}

    ######主要是看    mime.types;  里面的   你贴出来看看   或者你注释那一行 估计就没错了###### @leo108 @yintiefu 多谢,我看了下系统自带的 /etc/mime.types 文件好像有问题,将nginx源码 conf 目录下的 mime.types 文件替换掉系统自带的 mime.types 就 OK 了
    ######回复 @红薯 : 表芥末赤果果啊... 给小弟们一口饭吃啊.... 积分骚的可怜...######必须给我最佳答案哦:)
    2020-05-31 00:33:58
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载