[英]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.