V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  paloalto  ›  全部回复第 104 页 / 共 113 页
回复总数  2254
1 ... 96  97  98  99  100  101  102  103  104  105 ... 113  
@lemonda 我绑定了呀,而且我改了本地的hosts后能直接访问erwenit.appspot.com的。

203.208.45.206 erwenit.appspot.com
@beta4better 新的问题又出现了。在搞定了jiyin.it之后,我还有另一个域名2wen.it,是用跟jiyin.it同样的配置写的,但是访问时却是google的404错误页面。2wen.it的原始地址是 http://erwenit.appspot.com

server {
listen 80;
server_name jiyin.it www.jiyin.it *.jiyin.it;

location / {
proxy_pass http://ghs.google.com/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}

server {
listen 80;
server_name 2wen.it www.2wen.it *.2wen.it;

location / {
proxy_pass http://ghs.google.com/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
@beta4better 又见到你啦,刚看到你的邮件了。按你上面写的就没问题,发帖回帖也不会跳转到geekiwi.appspot.com了。

多谢!
@zhuzhuor 就是写的相对url。
@livid 看了一下,upstream是做负载均衡的。是因为我没做伏在均衡所以出现上面的问题吗?
不太懂这个,所以第一步没做。

第二步做了:

server {
listen 80;
server_name jiyin.it www.jiyin.it *.jiyin.it;

location / {
proxy_pass http://geekiwi.appspot.com/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}

但是这样访问jiyin.it之后就跳转到google.com了。。。奇怪啊。。
2012-03-20 15:56:06 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@aggron 我也遇到这问题,但是不知道什么原因。。。

@guoquan 我用的是Cyberduck,还挺好用的。
2012-03-20 15:25:39 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@lemonda @ccdjh @aggron @lowstz 多谢大家的帮忙,我刚换了台电脑能访问了。

应该是我自己那台电脑的hosts文件有问题,以前加过google的hosts。

再次感谢!
2012-03-20 15:20:39 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@lowstz @aggron 你们那边都可以直接用jiyin.it访问吗?我这边怎么还不行。。。。纠结。。
2012-03-20 15:19:41 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@ccdjh 新加的access_log是干嘛的?

[emerg]: open() "/var/log/nginx/localhost.access.log" failed (2: No such file or directory)
2012-03-20 15:14:23 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
把listen 81改成了listen 80后还是欢迎页面,会不会是nginx.conf里第一个server对第二个server有干扰?

重新帖一遍现在的nginx.conf的内容:

——————————nginx.conf文件:——————————

user www www;

worker_processes 2;

error_log /home/logs/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;
}

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 localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#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;
#}
}

server {
listen 80;
server_name jiyin.it;
location / {
proxy_redirect off;
proxy_pass http://geekiwi.appspot.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

}
2012-03-20 15:02:46 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@lemonda “vps上jiyin.it应指向vps的IP ”
——
请问你是说的hosts?还是nginx.conf里的proxy_pass项?
2012-03-20 14:59:18 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@lowstz 我改动了一下conf文件,然后新加上了你的。结果访问jiyin.it变成一个nginx的欢迎页面了。。。悲催。。。

——————————nginx.conf文件:——————————

user www www;

worker_processes 2;

error_log /home/logs/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;
}

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 localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#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;
#}
}

server {
listen 81;
server_name jiyin.it;
location / {
proxy_redirect off;
proxy_pass http://geekiwi.appspot.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

}
2012-03-20 14:53:07 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@lowstz 端口设置为每个server_name都不同?
2012-03-20 14:39:19 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@momou 刚才代码里没有}闭合,但是加上}闭合之后,还是不行

[root@vps www]# /usr/local/nginx/sbin/nginx -t
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful

依然跳转到探针页面。

贴出我的nginx.conf文件:

user www www;

worker_processes 1;

error_log /home/logs/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;
}

http
{
include mime.types;
default_type application/octet-stream;

#charse gb2312;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;

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 128k;

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;

#limit_zone crawler $binary_remote_addr 10m;

server
{
listen 80;
server_name bod.fm;
index index.html index.htm index.php;
root /home/www;

#limit_conn crawler 20;

#location /status {
#stub_status on;
#access_log off;
#}

location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}

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

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

log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/logs/access.log access;
}

server
{
listen 80;
server_name jiyin.it;

location / {
proxy_pass http://geekiwi.appspot.com/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

server
{
listen 80;
server_name yagbodu.com;

location / {
proxy_pass http://erwenit.appspot.com/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

}
2012-03-20 14:12:32 +08:00
回复了 paloalto 创建的主题 NGINX 折腾一晚vps,给nginx做域名反向代理失败,请教如何正确设置?
@momou 因为我刚删掉了vps的hosts中这段:

203.208.45.206 geekiwi.appspot.com

然后就502了。。
@lowstz 我直接重新装系统了,刚才尝试独立安装nginx失败,然后现在又在用LNMP安装包安装。
不知道什么结果。
@lowstz 我的没有这么多目录,而且启动nginx之后就一直占用80端口。

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

网上说需要killall -9 nginx来杀掉nginx进程,然后service nginx restart重启nginx
我试了,但还是占用80端口。
不想纠结原因了,估计是用LNAMP一键安装包在安装时没装好。
现在正在重装vps系统中。。。打算一个个的手动装,一键安装神马的不靠谱。
2012-03-19 15:46:03 +08:00
回复了 Livid 创建的主题 设计 frog 设计的新 Bloomberg 全球官网首页
一打开页面风扇要爆了
1 ... 96  97  98  99  100  101  102  103  104  105 ... 113  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2482 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 26ms · UTC 15:49 · PVG 23:49 · LAX 07:49 · JFK 10:49
Developed with CodeLauncher
♥ Do have faith in what you're doing.