Mono+Nginx环境

摘要:首先创建www用户和组, 虚拟主机使用的目录: /usr/sbin/groupadd www/usr/sbin/useradd -g www wwwmkdir -p /data0/htdocs/wwwchmod +w /data0/htdocs/wwwchown -R www:www /data0/htdocs/www 安装Momo yum groupinstall \"Developmen

首先创建www用户和组,

虚拟主机使用的目录:

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
mkdir -p /data0/htdocs/www
chmod +w /data0/htdocs/www
chown -R www:www /data0/htdocs/www

1 (27).jpg

安装Momo

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

wget http://pkgs.fedoraproject.org/repo/pkgs/mono/mono-2.6.1.tar.bz2/4cd2157c9eabbe9f49232d5ee3a2a57e/mono-2.6.1.tar.bz2

tar jxvf mono-2.6.1.tar.bz2

cd mono-2.6.1/

./configure --prefix=/usr

make

make install

cd ../

从SVN版本库安装fastcgi-momo-server

export PKG_CONFIG_PATH=/usr/lib/pkgconfig/:/usr/lib/

yum install subversion

svncohttp://mono-soc-2007.googlecode.com/svn/trunk/brian/FastCgi/fastcgi-mono-server

 

cd fastcgi-mono-server/

./autogen.sh

make

make install

cd ../

以Fastcgi方式启动fastcgi-momo-server2,监听本机9001端口,网页根目录为/data0/htdocs/www/

nohup /bin/sh /usr/local/bin/fastcgi-mono-server2 /socket=tcp:9001 /root=/data0/htdocs/www/ 2>&1 > /dev/null &

安装Nginx 0.8.46
1、安装Nginx所需的pcre库:

wget http://ftp.exim.llorien.org/pcre/pcre-8.12.tar.gz

tar zxvf pcre-8.12.tar.gz
cd pcre-8.12/
./configure
make && make install
cd ../

2、安装Nginx

wget http://nginx.org/download/nginx-0.8.46.tar.gz

tar zxvf nginx-0.8.46.tar.gz
cd nginx-0.8.46/
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../
3、创建Nginx日志目录

mkdir -p /data1/logs
chmod +w /data1/logs
chown -R www:www /data1/logs
4、创建Nginx配置文件

①、在/usr/local/webserver/nginx/conf/目录中创建nginx.conf文件:

rm -f /usr/local/webserver/nginx/conf/nginx.conf
vi /usr/local/webserver/nginx/conf/nginx.conf

修改nginx.conf

userwwwwww;

 

worker_processes8;

 

error_log/usr/local/webserver/nginx/logs/nginx_error.logcrit;

 

pid/usr/local/webserver/nginx/nginx.pid;

 

#Specifiesthevalueformaximumfiledescriptorsthatcanbeopenedbythisprocess.

 

worker_rlimit_nofile65535;

 

events

 

{

 

useepoll;

 

worker_connections65535;

 

}

 

http

 

{

 

includemime.types;

 

default_typeapplication/octet-stream;

 

charsetutf-8;

 

server_names_hash_bucket_size128;

 

client_header_buffer_size32k;

 

large_client_header_buffers432k;

 

client_max_body_size8m;

 

sendfileon;

 

tcp_nopushon;

 

keepalive_timeout60;

 

tcp_nodelayon;

 

 

 

fastcgi_connect_timeout300;

 

fastcgi_send_timeout300;

 

fastcgi_read_timeout300;

 

fastcgi_buffer_size64k;

 

fastcgi_buffers464k;

 

fastcgi_busy_buffers_size128k;

 

fastcgi_temp_file_write_size128k;

 

 

 

gzipon;

 

gzip_min_length1k;

 

gzip_buffers416k;

 

gzip_http_version1.1;

 

gzip_comp_level2;

 

gzip_typestext/plainapplication/x-javascripttext/cssapplication/xml;

 

gzip_varyon;

 

 

 

server

 

{

 

listen80;

 

server_namewww.yourdomain.com;

 

indexindex.htmlindex.htmindex.aspxdefault.aspx;

 

root/data0/htdocs/www;

 

 

 

location~.(aspx|asmx|ashx|asax|ascx|soap|rem|axd|cs|config|dll)?${

 

fastcgi_pass127.0.0.1:9001;

 

fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;

 

includefastcgi_params;

 

}

 

 

 

location~.*.(gif|jpg|jpeg|png|bmp|swf)$

 

{

 

expires30d;

 

}

 

 

 

location~.*.(js|css)?$

 

{

 

expires1h;

 

}

 

 

 

access_logoff;

 

}

 

}

 

测试配置文件是否正确

/usr/local/webserver/nginx/sbin/nginx -t

在/data0/htdocs/www/目录下载名为info.aspx的asp探针文件。检查asp.net是否能正常运行

cd /data0/htdocs/www/

wget http://aspnetsysinfo.googlecode.com/files/aspnetsysinfo-revision_23.zip

浏览器测试

http://IP/info.aspx