linux – nginx:[emerg]未知指令“”在/etc/nginx/sites-enable
发布时间:2020-12-13 18:30:42 所属栏目:Linux 来源:网络整理
导读:我已经按照这个网站 http://raspberrypihelp.net/tutorials/24-raspberry-pi-webserver在我的Raspberry Pi上设置HTTP服务器nginx并尝试设置一个站点调用example.com.但当我运行sudo服务nginx重启时,它说 Restarting nginx: nginx: [emerg] unknown directive
我已经按照这个网站
http://raspberrypihelp.net/tutorials/24-raspberry-pi-webserver在我的Raspberry Pi上设置HTTP服务器nginx并尝试设置一个站点调用example.com.但当我运行sudo服务nginx重启时,它说
这是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并再次添加. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |