Ubuntu13.04安装历险记--Mono,Nginx,Asp.Net一个都不能少
2014-08-21 17:53 咒语 阅读(353) 评论(0) 编辑 收藏 举报
----Ubuntu13.04安装历险记--新人新手新作-------------------------------------------------
注:以下操作均省略权限获取操作,如有需要,请sudo先获取权限
-----0.源变更-------------------------
(1) 备份
cp /etc/apt/sources.list /etc/apt/sources.list_backup
-----1.卸载apache2-------------------------
(1) 先卸载
apt-get --purge remove apache2
apt-get --purge remove apache2.2-common
apt-get autoremove
(2) (关键一步)找到没有删除掉的配置文件,一并删除
find /etc -name "*apache*" -exec rm -rf {} \;
-----2.安装Nginx -----------------------
apt-get install nginx
-----3. 安装mono------------------------
apt-get install mono-rumtime (如果内置了就不用安装,检查一下:mono -V)
apt-get install mono-fastcgi-server2 mono-fastcgi-server4 (会安装到/usr/bin/fastcgi-mono-server4)
-----4. 文件夹布署------------------------
(1) 建立站点目录
mkdir /var/www/mp.cszi.com
mkdir /var/www/nginx
(2) 在目录/usr/share/nginx/html下操作:拷贝原nginx默认目录的文件至新文件夹
cp * /var/www/nginx
(3) 在目录/var/www/下操作:保存mp.cszi.com站点的默认配置信息
nano mp.cszi.com.conf
#---------mp.cszi.com.conf---------------------
##
# mp.cszi.com.conf
##
server {
listen 80;
server_name mp.cszi.com;
access_log /var/www/mp.cszi.com/logs/access.log;
error_log /var/www/mp.cszi.com/logs/error.log crit;
location ~ {
root /var/www/mp.cszi.com/web;
index default.aspx Default.aspx index.aspx Index.aspx index.html index.htm;
#asp.net fastcgi add by yu 2013-01-11
#fastcgi_index default.aspx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
#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 /var/www/nginx-default;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
#----------------------------------------------
-----5. 配置信息更新------------------------
(1) 更新nginx的原始配置信息
nano /etc/nginx/sites-enabled/default
修改root目录为 /var/www/nginx
(2) 修改nginx的配置信息包含www目录下的所有配置信息
nano /etc/nginx/nginx.conf
(3) 建立用到的文件
nano /var/www/mp.cszi.com/logs/access.log
nano /var/www/mp.cszi.com/logs/error.log
(4) 重启服务
/etc/init.d/nginx restart
-----6. 让mono-fastcgi-server4自动运行起来------------------------
(1) 拷入下面的文件内容
nano /etc/init.d/monofastcgi
#---------monofastcgi---------------------
#!/bin/sh
### BEGIN INIT INFO
# Provides: monofastcgi.sh
# Required-Start: $local_fs $syslog $remote_fs
# Required-Stop: $local_fs $syslog $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start fastcgi mono server with hosts
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/mono
NAME=monofastcgi
DESC=monofastcgi
MONOFASTCGI=$(which fastcgi-mono-server4)
MONOFASTCGI_PID=$(ps auxf | grep fastcgi-mono-server4.exe | grep -v grep | awk '{print $2}')
WEBAPPS="mp.cszi.com:/:/var/www/mp.cszi.com/web/,www.cszi.com:/:/var/www/nginx/"
#----------------------------------------------
(2) 权限配置:
chmod 755 /etc/init.d/monofastcgi
(3) 安装启动脚步本
update-rc.d monofastcgi defaults
(4) 查看运行情况??
netstat -apn | grep port
(5)安装aspx探针
wget http://aspnetsysinfo.googlecode.com/files/aspnetsysinfo-revision_23.zip
unzip aspnetsysinfo-revision_23.zip
(6)启动monofastcgi
/etc/init.d/monofastcgi start
VI 使用说明:
-----------------------------
1. 全部删除:光标移到第一行 :.,$d (冒号+一个点+一个逗号+一个$+一个d再回车)
---------------
2. 撤消操作:按ESC键返回Command(命令)模式,然后按u键来撤消删除以前的删除或修改;如果您想撤消多个以前的修改或删除操作,请按多按几次u。这和Word的撤消操作没有太大的区别;
---------------
3. 保存与退出: :wq! 保存退出; :wq! filename 注:以filename为文件名保存后退出; :q! 不保存退出; :x 应该是保存并退出 ,功能和:wq!相同
--不错的源,13.04可用-------------------------
deb http://mirrors.oschina.net/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ raring-backports main restricted universe multiverse