我已经跟随该网站http://raspberrypihelp.net/tutorials/24-raspberry-pi- webserver在我的Raspberry Pi上设置HTTP服务器nginx并尝试设置一个站点调用 **example.com** 。但是当我跑步时sudo service nginx restart,它说
sudo service nginx restart
重新启动nginx:nginx:/etc/nginx/sites-enabled/example.com中的[emerg]未知指令“”: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在那里粘贴了一些脏(行尾)字符。
EOL
编辑器没有显示它们,而是nginx将它们视为指令。
nginx
只是删除每个,EOL然后再次添加。