Closed ghost closed 9 years ago
是不是 nginx 进程没重启?
才发邮件给你,还以为你没看到,如何启动?
@cuber 发给你的邮件附件里边有Nginx配置文件,你看看有没有问题。
看你的配置,应该是装了某个发行版,一般来说这样子就可以重启了
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start
login as: root root@45.62.103.101's password: Last login: Tue Aug 11 10:58:34 2015 from 117.95.165.65 [root@default ~]# sudo /etc/init.d/nginx stop sudo: /etc/init.d/nginx: command not found [root@default ~]# sudo /etc/init.d/nginx start sudo: /etc/init.d/nginx: command not found [root@default ~]#
怎么提示找不到?
不可能是发行版,下载的地址都是说明里上边一部分的过程
@cuber
你还是把你的环境,是编译安装的nginx还是其他,说清楚吧
@xavierskip 用的是这个页面的最简安装那个步骤的内容,没用下边的发行版:https://github.com/cuber/ngx_http_google_filter_module/blob/master/README.zh-CN.md
你怎么看?
建议使用 which nginx ,确认下 nginx 在哪里,然后在使用 重启命令呗。
@wenson 让你见笑了,Linux命令我一点都不了解,都是按照别人的步骤来的,这些真的不懂。
[root@default ~]# which nginx /usr/bin/which: no nginx in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
难道要我交出端口和密码?!
第一步: 查看 nginx是否正常启动? 命令:ps axu| grep nginx 如果没有启动建议可是使用find 命令 找下 nginx 在哪里 命令:find / -name nginx 然后尝试重启看看? 第二步: 查看配置文件是否正常? 建议贴出来 瞧瞧
@wenson 下边是运行命令的结果:
[root@default ~]# ps axu| grep nginx root 18564 0.0 0.5 5108 644 ? Ss 10:05 0:00 nginx: master process /opt/nginx-1.7.8/sbin/nginx nobody 18565 0.0 1.1 5244 1288 ? S 10:05 0:00 nginx: worker process root 18790 0.0 0.4 2280 556 pts/0 S+ 23:25 0:00 grep nginx [root@default ~]# find / -name nginx /root/nginx-1.7.8/objs/nginx /opt/nginx-1.7.8/sbin/nginx
配置文件待会邮给你,麻烦看一下。
@wenson 额,你的主页好像没你的邮箱,我发出来吧
worker_processes 1;
events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name jingwei.pub;
resolver 8.8.8.8;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
google on;
google_scholar on;
google_language "zh-CN";
google_robots_allow on;
google_ssl_off "www.google.com";
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
@zhongjingwei 1、 /opt/nginx-1.7.8/sbin/nginx stop 2、 /opt/nginx-1.7.8/sbin/nginx start 重启下web server 呗。
@wenson
[root@default ~]# /opt/nginx-1.7.8/sbin/nginx stop nginx: invalid option: "stop" [root@default ~]# /opt/nginx-1.7.8/sbin/nginx start nginx: invalid option: "start"
貌似还是不行
试试 这个 /opt/nginx-1.7.8/sbin/nginx -s reload
@wenson 哈哈OK了,不知道是那一步产生了效果,你知道吗?好像就是这条命令/opt/nginx-1.7.8/sbin/nginx -s reload ,这是什么意思,顺便学习一下
done. 改密码吧
重启 nginx 而已 参考资料: http://blog.chinaunix.net/uid-29791971-id-4702007.html
@wenson 我觉得这个速度不够快,显然没我的shadowsocks快,有没有什么办法优化一下?
@wenson 这是网址:jingwei.pub
你来体验一下速度,看看还能不能优化
@wenson 我又重做了一边,现在貌似又不行了,我输入/opt/nginx-1.7.8/sbin/nginx -s reload ,返回的结果是:
[root@default ~]# /opt/nginx-1.7.8/sbin/nginx -s reload nginx: [emerg] directive "resolver" is not terminated by ";" in /opt/nginx-1.7.8/conf/nginx.conf:43
这样正确吗?
@wenson 好吧,我看懂了,是我太大意,少了一个;
小小意见,这样写 配置文件不太干净,有空研究下 vhosts吧。 参考资料:http://tabalt.net/blog/nginx-virtual-host/
@wenson 好像是我的vps太渣了,后来我又在DigitalOcean上搭建了一下,几乎搜索结果都是秒开,就是心疼钱
很高兴你的问题解决了。 btw. 自从出了国际氮气瓶,上海电信根本无法愉快的玩耍了...
提示:
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.
Thank you for using nginx.
这是为什么?