yum groupinstall "Development Tools" |
yum install httpd build-essential gcc bzip bison pkgconfig glib-devel glib2-devel httpd-devel libpng-devel libX11-devel freetype fontconfig pango-devel ruby ruby-rdoc gtkhtml38-devel wget |
cd /usr/src/ |
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.8.2.tar.bz2 |
tar jxvf mono-2.6.1.tar.bz2 |
cd mono-2.6.1/ |
./configure --prefix=/usr |
make |
make install |
cd ../ |
从SVN版本库安装fastcgi-mono-server,按下面代码操作
export PKG_CONFIG_PATH=/usr/lib/pkgconfig/:/usr/lib/ |
yum install subversion |
cd /usr/src/ |
svn co http://mono-soc-2007.googlecode.com/svn/trunk/brian/FastCgi/ fastcgi-mono-server |
cd fastcgi-mono-server/ |
./autogen.sh |
make |
make install |
cd ../ |
以FastCGI方式启动fastcgi-mono-server2,监听本机的9001端口,网页根目录为/usr/share/nginx/html:
nohup /bin/sh /usr/local/bin/fastcgi-mono-server2 /socket=tcp:9001 /root=/usr/local/nginx/html /tuanwei 2>&1 > /dev/null & (/root=/usr/local/nginx/html/tuanwei)固定改目录下放web站点 Nginx与ASP.NET(FastCGI+Mono)的配置#user nobody; worker_processes 8; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { worker_connections 65535; } 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; server_names_hash_bucket_size 128; client_max_body_size 8m; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; client_header_buffer_size 1k; large_client_header_buffers 4 42k; gzip on; gzip_min_length 1100; gzip_buffers 4 8k; # gzip_types text/plain; gzip_types text/plain text/css text/xml application/x-javascript application/atom+xml application/rss+xml; output_buffers 1 32k; postpone_output 1460; sendfile on; tcp_nopush on; tcp_nodelay on; #send_lowat 12000; keepalive_timeout 75 20; 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; server { listen 80; server_name 10.0.0.117; root /usr/local/nginx/html; index index.html index.htm index.aspx default.aspx info.aspx; #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #} location ~ \.(aspx|asmx|ashx|asax|ascx|soap|rem|axd|cs|config|dll)?$ { fastcgi_pass 127.0.0.1:9001; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log off; expires 30d; root /usr/local/nginx/html; } #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; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } 在上面虚拟主机配置文件中,静态HTML网页、图片、JS、CSS、Flash等使用Nginx来处理, 以便得到更快的速度,文件扩展名 为:.aspx .asmx .ashx .asax .ascx .soap .rem .axd .cs .config .dll的请求,由Nginx交给fastcgi-mono-server2进程处理。 启动Nginx,在/usr/share/nginx/html目录下下载info.apsx的ASP.NET探针文件,以检查ASP.NET程序能否正常运行:
通过游览器访问http://apsnettest.15099.net/info.aspx。 |