xplicit / HyperFastCgi

Performant nginx to mono fastcgi server
MIT License
129 stars 49 forks source link

Can somebody give me a full example? #40

Closed guotie closed 8 years ago

guotie commented 8 years ago

Now, My dir tree is as following:

[guotie@linux-188-235 monoTest]$ pwd /home/guotie/monoTest/monoTest

[guotie@linux-188-235 monoTest]$ tree . |-- Content |-- Controllers | -- HomeController.cs |-- Global.asax |-- Global.asax.cs |-- Models |-- Scripts |-- Views | |-- Home | |-- Index.aspx | |-- Shared | | -- Error.aspx |-- Web.config |-- Web.config |-- bin | |-- Microsoft.Web.Infrastructure.dll | |-- System.Web.Helpers.dll | |-- System.Web.Helpers.xml | |-- System.Web.Mvc.dll | |-- System.Web.Mvc.xml | |-- System.Web.Razor.dll | |-- System.Web.Razor.xml | |-- System.Web.WebPages.Deployment.dll | |-- System.Web.WebPages.Deployment.xml | |-- System.Web.WebPages.Razor.dll | |-- System.Web.WebPages.Razor.xml | |-- System.Web.WebPages.dll | |-- System.Web.WebPages.xml | |-- monoTest.dll | -- monoTest.pdb |-- com.config |-- com.config.bak |-- monoTest.csproj |-- monoTest.sln |-- monoTest.userprefs |-- obj | |-- Debug | | |-- TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs | | |-- TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs | |-- TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs | -- Release | |-- TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs | |-- TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs | |-- TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs | |-- monoTest.csproj.FileListAbsolute.txt | |-- monoTest.csprojResolveAssemblyReference.cache | |-- monoTest.dll |-- monoTest.pdb |-- packages | |-- Microsoft.AspNet.Mvc.5.2.0 | | |-- Content | | | |-- Web.config.install.xdt | | | -- Web.config.uninstall.xdt | | |-- Microsoft.AspNet.Mvc.5.2.0.nupkg | |-- lib | | -- net45 | | |-- System.Web.Mvc.dll | |-- System.Web.Mvc.xml | |-- Microsoft.AspNet.Razor.3.2.0 | | |-- Microsoft.AspNet.Razor.3.2.0.nupkg | | -- lib | |-- net45 | | |-- System.Web.Razor.dll | | -- System.Web.Razor.xml | |-- Microsoft.AspNet.WebPages.3.2.0 | | |-- Content | | | |-- Web.config.install.xdt | | |-- Web.config.uninstall.xdt | | |-- Microsoft.AspNet.WebPages.3.2.0.nupkg | | -- lib | |-- net45 | | |-- System.Web.Helpers.dll | | |-- System.Web.Helpers.xml | | |-- System.Web.WebPages.Deployment.dll | | |-- System.Web.WebPages.Deployment.xml | | |-- System.Web.WebPages.Razor.dll | | |-- System.Web.WebPages.Razor.xml | | |-- System.Web.WebPages.dll | | -- System.Web.WebPages.xml | |-- Microsoft.Web.Infrastructure.1.0.0.0 | | |-- Microsoft.Web.Infrastructure.1.0.0.0.nupkg | |-- lib | | -- net40 | |-- Microsoft.Web.Infrastructure.dll | -- repositories.config -- packages.config

26 directories, 60 files

And com.config is :

[guotie@linux-188-235 monoTest]$ cat com.config

 <configuration>
       <server type="HyperFastCgi.ApplicationServers.SimpleApplicationServer">
             <!-- Host factory defines how host will be created. SystemWebHostFactory creates host in AppDomain in standard ASP.NET way --> 
            <host-factory>HyperFastCgi.HostFactories.SystemWebHostFactory</host-factory>
            <!-- <threads> creates threads at startup. Value "0" means default value --> 
            <threads min-worker="40" max-worker="0" min-io="4" max-io="0" />
            <!--- Sets the application host root directory -->
      </server>

  <listener type="HyperFastCgi.Listeners.ManagedFastCgiListener">
            <listener-transport type="HyperFastCgi.Transports.CombinedFastCgiListenerTransport"></listener-transport>
            <apphost-transport type="HyperFastCgi.Transports.CombinedAppHostTransport"></apphost-transport>
            <protocol>InterNetwork</protocol>
        <address>0.0.0.0</address>
            <port>9000</port>
</listener>

<apphost type="HyperFastCgi.AppHosts.AspNet.AspNetApplicationHost">
            <log level="All" write-to-console="true" />
            <add-trailing-slash>false</add-trailing-slash>
</apphost>
<web-application>
    <name>Root</name>
    <vpath>/</vpath>
    <path>/home/guotie/monoTest/monoTest/</path>
<!-- vhost and port are ignored in xsp.exe -->
    <vhost>*</vhost>
    <vport>9000</vport>
<!-- <enabled> is true by default -->
<!-- <enabled>false</enabled> -->
</web-application>

</configuration>

When i run hyperfastcgi: [guotie@linux-188-235 monoTest]$ hyperfastcgi4 /config=./com.config /printlog /verbose /loglevels=All [2015-10-28 01:38:14Z] Debug HyperFastCgi [2015-10-28 01:38:14Z] Debug Threadpool minw=40,minio=4,maxw=100,maxio=4 [2015-10-28 01:38:14Z] Debug Root directory: /home/guotie/monoTest/monoTest host-list.c:38: register_host(): *:9000:/:/home/guotie/monoTest/monoTest/ host=0x7f94683e4d90 pinned_host=0x7f94683e4d90 domain=0x13e6770 [2015-10-28 01:38:14Z] Debug Configured host in domain 83694651, id=1 [2015-10-28 01:38:14Z] Debug Listening on port: 9000 [2015-10-28 01:38:14Z] Debug Listening on address: 0.0.0.0 [2015-10-28 01:38:14Z] Debug Application started

But I use chrome visit localhost:9000/, there is no response?

where is the problem?

guotie commented 8 years ago

This is a "hello world" ASP.NET MVC project, and i can use xsp4 run it.

guotie commented 8 years ago

[guotie@linux-188-235 monoTest]$ uname -a Linux linux-188-235 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [guotie@linux-188-235 monoTest]$ mono -V Mono JIT compiler version 4.0.4 (Stable 4.0.4.1/5ab4c0d Tue Aug 25 18:58:45 EDT 2015) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen

xplicit commented 8 years ago

HyperFastCgi works with nginx or any other web-server which supports FactCGI protocol. To view the web page you must configure nginx too.

Here the documentation how it can be done https://github.com/xplicit/HyperFastCgi/wiki/Nginx-configuration