VPS侦探论坛

 找回密码
 注册
查看: 10390|回复: 3

nginx: [emerg] directive "location" has no opening "{" in /u

[复制链接]
发表于 2015-4-21 20:55:52 | 显示全部楼层 |阅读模式

手贱按网上的方法改lnmp默认站点和主机头值就报错了,然后又复制网上的那个就报这个错了,求大牛破。
nginx: [emerg] directive "location" has no opening "{" in /usr/local/nginx/conf/nginx.conf:72
failed. Use force-quit
还有如何设置强制允许https。我在www.xxx.com.conf里删掉了80那一行,http的指向了默认lnmp页面,求破。。还有怎么设置用户不能通过ip访问服务器。或者说就是ip访问就像该服务器没有搭建web服务的样子。
nginx.conf的代码如下:
user  www www;

worker_processes auto;

error_log  /home/wwwlogs/nginx_error.log  crit;

pid        /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events

{

use epoll;

worker_connections 51200;

multi_accept on;

}

http

{

include       mime.types;

default_type  application/octet-stream;


server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

client_max_body_size 50m;


sendfile on;

tcp_nopush     on;


keepalive_timeout 60;


tcp_nodelay on;


fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 256k;


gzip on;

gzip_min_length  1k;

gzip_buffers     4 16k;

gzip_http_version 1.0;

gzip_comp_level 2;

gzip_types       text/plain application/x-javascript text/css application/xml;

gzip_vary on;

gzip_proxied        expired no-cache no-store private auth;

gzip_disable        "MSIE [1-6]\.";


#limit_conn_zone $binary_remote_addr zone=perip:10m;

##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.


server_tokens off;

#log format

log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
server {
            listen 80;
            server_name www.lnmp.org;
            access_log /home/wwwlogs/access_nginx.log combined;
            root /home/wwwroot/default;
            index index.html index.php;
            if ( $query_string ~* ".*[\;'\<\>].*" ){
                    return 404;
                    }

            location ~ .*\. (php|php5)? [        DISCUZ_CODE_14        ]nbsp; {
                    #fastcgi_pass remote_php_ip:9000;
                    fastcgi_pass unix:/dev/shm/php-cgi.sock;
                    fastcgi_index index.php;
                    include fastcgi.conf;
                    }

            location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
                    expires 30d;
                    }

            location ~ .*\.(js|css)?$ {
                    expires 7d;
                    }
            }

access_log  /home/wwwlogs/access.log  access;

}
include vhost/*.conf;
}
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-4-22 09:06:46 | 显示全部楼层


location ~ .*\. (php|php5)? [        DISCUZ_CODE_14        ]nbsp; { 这一行很明显的错误

fastcgi_pass unix:/dev/shm/php-cgi.sock; 这一行也不对
你可以看一下lnmp安装包里的nginx.conf

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2015-4-22 09:12:53 | 显示全部楼层

回复 2# 的帖子


亲。我已经重装了。请问我该如何关闭默认的安装成功站点就是说关闭不能通过ip访问站点。还有就是如何强制https访问。网上的方法试了不是这出问题就是那出问题,我是用的centos6.6 64位
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-4-22 21:43:32 | 显示全部楼层



论坛里搜索空主机头

参考:http://lnmp.org/faq/lnmp-nginx-301-rewrite.html
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-5-17 17:51 , Processed in 0.028223 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表