Mono+Nginx环境
2019獨角獸企業重金招聘Python工程師標準>>>
首先創建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
安裝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
svn?co?http://mono-soc-2007.googlecode.com/svn/trunk/brian/FastCgi/?fastcgi-mono-servercd 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
user??www?www; worker_processes?8; error_log??/usr/local/webserver/nginx/logs/nginx_error.log??crit; pid????????/usr/local/webserver/nginx/nginx.pid; #Specifies?the?value?for?maximum?file?descriptors?that?can?be?opened?by?this?process. worker_rlimit_nofile?65535; events { use?epoll; worker_connections?65535; } http { include???????mime.types; default_type??application/octet-stream; charset??utf-8; 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.1; gzip_comp_level?2; gzip_types??????text/plain?application/x-javascript?text/css?application/xml; gzip_vary?on;
server { listen???????80; server_name??www.yourdomain.com; index?index.html?index.htm?index.aspx?default.aspx; root??/data0/htdocs/www;
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?~?.*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires??????30d; }
location?~?.*\.(js|css)?$ { expires??????1h; }
access_log??off; } }
測試配置文件是否正確
/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
轉載于:https://my.oschina.net/HeAlvin/blog/370762
總結
以上是生活随笔為你收集整理的Mono+Nginx环境的全部內容,希望文章能夠幫你解決所遇到的問題。

- 上一篇: VMware宋家瑜:U2VL要趁早
- 下一篇: v4l2