首页 新闻 会员 周边 捐助

在ubuntu上运行nginx+mono,端口号设为8080出问题了

0
悬赏园豆:100 [已解决问题] 解决于 2010-05-13 00:23

我也是在ubuntu10.04上测试,但是运行mvc,老是不行,除非指定文件名访问,我访问/Home/Index也是可以,但是访问http://www.host.com/不行,楼主遇到过这个问题吗?还是如果nginx端口号不是80的话,我会报错!我测试端口为8080

No Application Found

Unable to find a matching application for request:
Hostwww.host.com:8080
Port8081
Request Path/info.aspx
Physical Path/home/host/www/default/info.aspx

端口没有占用

 

nginx配置

1 server {
2 listen 8080;
3   server_name www.host.com;
4   access_log /var/log/nginx/localhost.access.log;
5 root /home/host/www/default;
6 index index.html index.htm default.aspx Default.aspx;
7
8 location / {
9
10
11 fastcgi_index Default.aspx;
12 fastcgi_pass 127.0.0.1:9000;
13 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
14 include /etc/nginx/fastcgi_params;
15
16 }

 

我加入一个脚本随nginx启动

1
2 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
3 DAEMON=/usr/sbin/nginx
4 NAME=nginx
5 DESC=nginx
6
7
8 MONOSERVER=$(which fastcgi-mono-server2)
9 MONOSERVER_PID=$(ps auxf | grep fastcgi-mono-server2.exe | grep -v grep | awk '{print $2}')
10
11 WEBAPPS="www.9idu.com:/:/home/host/www/default/"
12
13 test -x $DAEMON || exit 0
14
15 # Include nginx defaults if available
16 if [ -f /etc/default/nginx ] ; then
17 . /etc/default/nginx
18 fi
19
20 set -e
21
22 . /lib/lsb/init-functions
23
24 test_nginx_config() {
25 if nginx -t $DAEMON_OPTS
26 then
27 return 0
28 else
29 return $?
30 fi
31 }
32
33 case "$1" in
34 start)
35
36 if [ -z "${MONOSERVER_PID}" ]; then
37 echo "starting mono server"
38 ${MONOSERVER} /applications=${WEBAPPS} /socket=tcp:127.0.0.1:9000 &
39 echo "mono server started"
40 else
41 echo ${MONOSERVER} /applications=${WEBAPPS} /socket=tcp:127.0.0.1:9000 &
42 echo "mono server is running"
43 fi
44 echo -n "Starting $DESC: "
45 test_nginx_config
46 start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
47 --exec $DAEMON -- $DAEMON_OPTS || true
48 echo "$NAME."
49 ;;
50 stop)
51
52 if [ -n "${MONOSERVER_PID}" ]; then
53 kill ${MONOSERVER_PID}
54 echo "mono server stopped"
55 else
56 echo "mono server is not running"
57 fi
58
59 echo -n "Stopping $DESC: "
60 start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
61 --exec $DAEMON || true
62 echo "$NAME."
63 ;;
64 restart|force-reload)
65 echo -n "Restarting $DESC: "
66 start-stop-daemon --stop --quiet --pidfile \
67 /var/run/$NAME.pid --exec $DAEMON || true
68 sleep 1
69 test_nginx_config
70 start-stop-daemon --start --quiet --pidfile \
71 /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
72 echo "$NAME."
73 ;;
74 reload)
75 echo -n "Reloading $DESC configuration: "
76 test_nginx_config
77 start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
78 --exec $DAEMON || true
79 echo "$NAME."
80 ;;
81 configtest)
82 echo -n "Testing $DESC configuration: "
83 if test_nginx_config
84 then
85 echo "$NAME."
86 else
87 exit $?
88 fi
89 ;;
90 status)
91 status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
92 ;;
93 *)
94 echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2
95 exit 1
96 ;;
97 esac
98
99 exit 0

 

petersun的主页 petersun | 菜鸟二级 | 园豆:215
提问于:2010-05-11 19:32
< >
分享
最佳答案
0

ok,看了完整的记录,对你的问题有了大致的了解

1.对于非80端口访问出现问题的情况,应该是你在启动fastcgi-mono-server2的时候制定Applications是强制指定了域名,因此导致非80端口不匹配问题,去掉指定的域名即可.

2.对于你说的访问/不可访问问题,这个并不奇怪,你说可以访问/Home/Index,说明mvc已经成功运行,而无法访问/说明mono不会自动跳转,因此,你可能需要在default.aspx中手动跳转到/Home/Index.

收获园豆:100
Leven | 菜鸟二级 |园豆:330 | 2010-05-12 15:27
谢谢,问题解决了!没想到对applications强制指定域名,还有这个问题!
petersun | 园豆:215 (菜鸟二级) | 2010-05-13 00:22
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册