Centos6.3 + mono3.0.3 + nginx1.2.6 configuration process

Source: Internet
Author: User
Tags syslog

[Mono]

----------------------------------------

Resource:

Mono: https://wrench.mono-project.com/Wrench/

Xsp: https://github.com/mono/xsp

PC: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

Nginx: http://nginx.org/en/download.html

Download all the latest versions. There are four files:

Mono-3.0.3.tar.bz2

Xsp-master.zip

Pcre-8.32.tar.bz2

Nginx-1.2.6.tar.gz

-----------------------------------------

 

After centos6.3 is installed, the network is disabled by default. Enable it first:

VI/etc/sysconfig/network-scripts/ifcfg-eth0

 

Modify the parameters as follows:

Nm_controlled = "no"

Onboot = "yes"

 

Save and run:

/Etc/init. d/network restart

 

Then open port 80:

/Sbin/iptables-I input-P TCP -- dport 80-J accept

/Etc/init. d/iptables save

/Etc/init. d/iptables restart

 

First, we need to explain why we chose source code compilation and installation to experience the latest mono functions, especially entityfamework and mvc4.

Nginx is a little special. If you use the RPM package to install nginx, it will lead to FastCGI-mono-server not running, and this problem is hard for me for a week.

 

Now install the compiling environment and execute:

Yum-y install GCC gcc-C ++ bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel LibTIFF-devel libexif-devel giflib-devel libX11-devel FreeType-devel fontconfig-devel Cairo-devel libTIFF-devel libjpeg-devel kernel libpng-devel libx11 libX11-devel FreeType-devel fontconfig-devel libexif-devel kernel-devel ghostscript-devel gnome-Doc- utils unzip

(A lot of things, who knows which ones can save, just delete them. I did not verify them one by one .)

 

Use SFTP tool (xftp4 recommended) to copy the four downloaded files to the centos/root directory.

Run

Tar-jvxf mono-3.0.3.tar.bz2

Unzip xsp-master.zip

Tar-jvxf pcre-8.32.tar.bz2

Tar-vxf nginx-1.2.6.tar.gz

Decompress dimension.

 

Now the longest mono compilation and Installation

CD/root/mono-3.0.3

./Configure

Make

Make install

 

About 15 minutes. You can watch two videos using vs2012 at this time. Like codemap...

 

Then install xsp:

CD/root/xsp-Master

Export pkg_config_path =/usr/lib64/pkgconfig

./Autogen. Sh

Make

Make install

The pkg_config_path is installed using yum, and the path may be different in different systems.

Available

Whereis pkgconfig

Find the pkgconfig path and modify the Export Statement as needed.

If the pkgconfig path is incorrect, xsp cannot find mono.

 

Originally, nginx should be compiled and installed directly.

However, nginx depends on PCRE, so:

CD/root/pcre-8.32

./Configure

Make

Make install

 

Then install nginx:

CD/root/nginx-1.2.6

./Configure

Make

Make install

 

After the configuration is complete, start:

 

First of all, compile and install the script is not started, here need two, one is the nginx STARTUP script, one is the fastcgi-mono-server4 STARTUP script.

Refer:

Http://www.21andy.com/blog/20100201/1606.html

Http://yojimbo87.github.com/2010/03/14/mono-startup-script.html

I directly paste it below and pay attention to the path and environment variables.

Nginx:

  1 #!/bin/sh  2 #  3 # nginx - this script starts and stops the nginx daemin  4 #  5 # chkconfig:   - 85 15   6 # description:  Nginx is an HTTP(S) server, HTTP(S) reverse \  7 #               proxy and IMAP/POP3 proxy server  8 # processname: nginx  9 # config:      /usr/local/nginx/conf/nginx.conf 10 # pidfile:     /usr/local/nginx/logs/nginx.pid 11  12 # Source function library. 13 . /etc/rc.d/init.d/functions 14  15 # Source networking configuration. 16 . /etc/sysconfig/network 17  18 # Check that networking is up. 19 [ "$NETWORKING" = "no" ] && exit 0 20  21 nginx="/usr/local/nginx/sbin/nginx" 22 prog=$(basename $nginx) 23  24 NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" 25  26 lockfile=/var/lock/subsys/nginx 27  28 start() { 29     [ -x $nginx ] || exit 5 30     [ -f $NGINX_CONF_FILE ] || exit 6 31     echo -n $"Starting $prog: " 32     daemon $nginx -c $NGINX_CONF_FILE 33     retval=$? 34     echo 35     [ $retval -eq 0 ] && touch $lockfile 36     return $retval 37 } 38  39 stop() { 40     echo -n $"Stopping $prog: " 41     killproc $prog -QUIT 42     retval=$? 43     echo 44     [ $retval -eq 0 ] && rm -f $lockfile 45     return $retval 46 } 47  48 restart() { 49     configtest || return $? 50     stop 51     start 52 } 53  54 reload() { 55     configtest || return $? 56     echo -n $"Reloading $prog: " 57     killproc $nginx -HUP 58     RETVAL=$? 59     echo 60 } 61  62 force_reload() { 63     restart 64 } 65  66 configtest() { 67   $nginx -t -c $NGINX_CONF_FILE 68 } 69  70 rh_status() { 71     status $prog 72 } 73  74 rh_status_q() { 75     rh_status >/dev/null 2>&1 76 } 77  78 case "$1" in 79     start) 80         rh_status_q && exit 0 81         $1 82         ;; 83     stop) 84         rh_status_q || exit 0 85         $1 86         ;; 87     restart|configtest) 88         $1 89         ;; 90     reload) 91         rh_status_q || exit 7 92         $1 93         ;; 94     force-reload) 95         force_reload 96         ;; 97     status) 98         rh_status 99         ;;100     condrestart|try-restart)101         rh_status_q || exit 0102             ;;103     *)104         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"105         exit 2106 esac

 

Fastcgi-mono-server4:

 1 #!/bin/sh 2  3 ### BEGIN INIT INFO 4 # Provides:          monoserve.sh 5 # Required-Start:    $local_fs $syslog $remote_fs 6 # Required-Stop:     $local_fs $syslog $remote_fs 7 # Default-Start:     2 3 4 5 8 # Default-Stop:      0 1 6 9 # Short-Description: Start fastcgi mono server with hosts10 ### END INIT INFO11 12 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin13 DAEMON=/usr/local/bin/mono14 NAME=fastcgi-mono-server415 DESC=fastcgi-mono-server416 17 MONOSERVER=$(which fastcgi-mono-server4)18 MONOSERVER_PID=$(ps auxf | grep fastcgi-mono-server4.exe | grep -v grep | awk '{print $2}')19 20 WEBAPPS="/:/usr/local/nginx/html"21 22 case "$1" in23         start)24                 if [ -z "${MONOSERVER_PID}" ]; then25                         echo "starting mono server"26                         ${MONOSERVER} /applications=${WEBAPPS} /socket=tcp:127.0.0.1:9000 &27                         echo "mono server started"28                 else29                         echo ${WEBAPPS}30                         echo "mono server is running"31                 fi32         ;;33         stop)34                 if [ -n "${MONOSERVER_PID}" ]; then35                         kill ${MONOSERVER_PID}36                         echo "mono server stopped"37                 else38                         echo "mono server is not running"39                 fi40         ;;41 esac42 43 exit 0

 

Save the script in the/etc/init. d/directory.

 

Run:

Chmod + x/etc/init. d/nginx

Chmod + x/etc/init. d/fastcgi-mono-server4

 

/Sbin/chkconfig nginx on

/Sbin/chkconfig the fastcgi-mono-server4 on

 

Finally, nginx CONF configuration, in theory is to configure and then write the startup script, because the webapps path in the fastcgi-mono-server4 STARTUP script must be consistent with the website path, so pay attention to the configuration.

Refer:

Http://www.mono-project.com/FastCGI_Nginx

First, modify the fastcgi_params file. According to my method, it should be in the/usr/local/nginx/conf directory. (not in? Use whereis fastcgi_params to find it .)

Append two rows:

Fastcgi_param path_info "";

Fastcgi_param script_filename $ document_root $ fastcgi_script_name;

 

Save and then configure the nginx. conf file

Find:

Location /{

Root HTML;

Index index.html index.htm;

}

Change

Location /{

Root HTML;

Index default. aspx index.html index.htm;

Fastcgi_index default. aspx;

Fastcgi_pass 127.0.0.1: 9000;

Include fastcgi_params;

}

Added three rows.

 

Note that the root HTML is configured with the root directory of the website. It is a relative path.

 

After all the files are saved, you can enable the Service. Run:

/Etc/init. d/fastcgi-mono-server4 start

/Etc/init. d/nginx start

 

Now, open the Server IP address in the browser and you will see:

 

Thanks:

Http://www.cnblogs.com/wang_yb/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.