简体   繁体   English

nginx:[emerg] example.com中的未知指令“”:3

[英]nginx: [emerg] unknown directive “ ” in example.com: 3

I have followed this website http://raspberrypihelp.net/tutorials/24-raspberry-pi-webserver to setup the HTTP server nginx on my Raspberry Pi and try to setup a site call example.com . 我已经跟随该网站http://raspberrypihelp.net/tutorials/24-raspberry-pi-webserver在我的Raspberry Pi上设置HTTP服务器nginx并尝试设置一个站点调用example.com But when I run sudo service nginx restart , it said 但是当我运行sudo service nginx restart ,它说

Restarting nginx: nginx: [emerg] unknown directive " " in /etc/nginx/sites-enabled/example.com:3 重新启动nginx:nginx:/etc/nginx/sites-enabled/example.com中的[emerg]未知指令“”:3

Here is the code in example.com . 这是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;

    }

}

I've used /usr/sbin/nginx -t -v to checked that I 'm using nginx/1.2.1. 我已经使用/usr/sbin/nginx -t -v来检查我是否正在使用nginx / 1.2.1。 I can go to http:/127.0.0.1 see the default site (/usr/share/nginx/www/index.html) that means it can run the file /etc/nginx/sites-enabled/default . 我可以转到http:/127.0.0.1看到默认站点(/usr/share/nginx/www/index.html),这意味着它可以运行文件/ etc / nginx / sites-enabled / default I am just following the steps but it can't run successfully. 我只是按照步骤操作,但无法成功运行。

Try to add this line: 尝试添加以下行:

server {

listen 192.168.1.88:80; // Add this "listen" with port 80
server_name example.com www.example.com;

# Rest of code
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 nginx:[emerg] /etc/nginx/sites-enabled/example.com:3 中的未知指令“” - nginx: [emerg] unknown directive " " in /etc/nginx/sites-enabled/example.com:3 /etc/nginx/sites-enabled/example.com + HttpUploadProgressModule中的未知指令“” - Unknown directive “ ” in /etc/nginx/sites-enabled/example.com + HttpUploadProgressModule (Nginx Windows)nginx:[emerg] 未知指令“serversupstream” - (Nginx Windows) nginx: [emerg] unknown directive “serversupstream” nginx: [emerg] 未知指令“gop_cache” - nginx: [emerg] unknown directive "gop_cache" nginx:[emerg]未知指令“ absolute_redirect” - nginx: [emerg] unknown directive “absolute_redirect” Nginx , LetsEncrypt - [emerg] “ssl_certificate”指令在 /etc/nginx/sites-enabled/example.com.conf:33 nginx 中是不允许的: - Nginx , LetsEncrypt - [emerg] “ssl_certificate” directive is not allowed here in /etc/nginx/sites-enabled/example.com.conf:33 nginx: Nginx:将http://example.com和http://*.example.com都重定向到https://example.com - Nginx: Redirect both http://example.com and http://*.example.com to https://example.com 如何解决Nginx错误nginx:conf:1中的[emerg]未知指令“ server”? - How to resolve Nginx error nginx: [emerg] unknown directive “server” in conf:1? nginx子域配置example.com/blog - nginx subdomain configuration example.com/blog Nginx:将所有内容重定向到http://example.com - Nginx: Redirect everything to http://example.com
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM