微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – nginx:[emerg]未知指令“”在/etc/nginx/sites-enabled/example.com:3

我已经按照这个网站http://raspberrypihelp.net/tutorials/24-raspberry-pi-webserver在我的RaspBerry Pi上设置HTTP服务器Nginx并尝试设置一个站点调用example.com.但当我运行sudo服务Nginx重启时,它说

Restarting Nginx: Nginx: [emerg] unkNown directive ” ” in /etc/Nginx/sites-enabled/example.com:3

这是example.com中的代码.

    server {

    server_name example.com 192.168.1.88;

    access_log /srv/www/example.com/logs/access.log;

    error_log /srv/www/example.com/logs/error.log;

    root /srv/www/example.com/public/;

    location / {

        index index.PHP index.html index.htm;

        try_files $uri $uri/ /index.PHP?$args;

    }

    location ~ \.PHP${

        include /etc/Nginx/fastcgi_params;

        fastcgi_pass unix:/var/run/PHP5-fpm.sock;

        fastcgi_index index.PHP;

        fastcgi_param SCRIPT_FILENAME /srv/www/example.com/public$fastcgi_script_name;

    }

    location /PHPmyadmin {

        root /usr/share/;

        index index.PHP index.html index.htm;

        location ~ ^/PHPmyadmin/(.+\.PHP)${

            try_files $uri =404;

            root /usr/share/;

            fastcgi_pass unix:/var/run/PHP5-fpm.sock;

            fastcgi_index index.PHP;

            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

            include /etc/Nginx/fastcgi_params;

        }

        location ~* ^/PHPmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))${

            root /usr/share/;

        }

    }

    location /PHPMyAdmin {

        rewrite ^/* /PHPmyadmin last;

    }

}

我只是按照步骤,但它无法成功运行.

最佳答案
我有同样的问题,那就是我从网上复制/粘贴配置代码和一些脏的EOL(行尾)字符.

编辑器没有显示它们,但是Nginx将它们视为指令.

删除每个EOL并再次添加.

原文地址:https://www.jb51.cc/nginx/434885.html

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

相关推荐