requarks / wiki-v1

Legacy version (1.x) of Wiki.js
https://wiki.js.org
GNU Affero General Public License v3.0
101 stars 75 forks source link

IIS Setup Documentation #148

Open akarel opened 6 years ago

akarel commented 6 years ago

Actual behavior

Setting up Wiki.js to run on IIS was kind of a pain, but isn't actually that hard. There just isn't any directly related documentation.

Expected behavior

It should be easier to run via IIS.

Steps to reproduce the behavior

Install Wiki.js and have it run on IIS without any documentation.

I'm happy to provide the steps that worked for me if you want one way to do it for your docs. I wrote it out below. Hope this helps someone.


Running Wiki.js on IIS

  1. On the server/computer where IIS is running, install iisnode
    1. A restart may be required for iisnode to properly pick up Node.js from the environment path, if it is set there, otherwise an additional configuration setting will be required (see Web.config below)
  2. In IIS, create a new website whose virtual directory is the folder where Wiki.js was installed (e.g. C:\wiki\)
  3. Add the file wikiSiteInit.js to the root site folder (same as in the previous step)
    1. The only content of the file should be: require('./server/index.js');
  4. Add a Web.Config to the root site folder (the same as in the previous steps)
<configuration>
  <system.webServer>

  <!-- Uncomment the following line if Node.js is not available via the environment path -->
  <!-- <iisnode nodeProcessCommandLine="{Path to node.exe}" /> -->

    <handlers>
      <add name="iisnode" path="wikiSiteInit.js" verb="*" modules="iisnode" />
    </handlers>

    <rewrite>
      <rules>
        <rule name="default">
          <match url="/*" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
          <action type="Rewrite" url="wikiSiteInit.js" />
        </rule>
      </rules>
    </rewrite>

  </system.webServer>
</configuration>
NGPixel commented 6 years ago

Thanks! I'll add it to the documentation soon.

jimromaine commented 5 years ago

Thank you for these instructions. They helped a lot in our IIS deployment.

One other thing that might be an issue that we got stuck on for hours... In the config.yml file, don't put a port. Keep it empty, as in:

image

IIS 10 will handle the ports via it's bindings.

wooster11 commented 5 years ago

I also want to note that I had a small problem after getting it up and running where I couldn't save any edited pages. Of course, no error message would pop-up (just an empty error popup after clicking save) and I had to dig in to first find the logs and then interpret those logs.

Turns out that my application pool didn't have the proper rights to access the .gitconfig file.

I recommend that a new Application Pool be created and the identity used for that pool be set to Local System.

wooster11 commented 5 years ago

I just found another issue running with Node IIS. It appears that items don't get synched automatically with my git repo.

Even though I can see a bunch of git processes running in the task manager, it fails to push changes. In addition, file uploads fail. Files are copied over to the repo folder, but don't get synched with git and Wiki.js is unable to fetch the file listing.

Once I switched back to running directly under node, this all worked again.

Just something to keep in mind with 2.x to see if we can get full Node IIS support.

toose commented 5 years ago

Hey @wooster11, since you've gotten this up and running behind IIS, i was wondering if you could help me out.

The problem seems to be that my browser is caching the content of these pages, so when I update a page through the web interface, the page gets updated correctly, I can confirm that the file on the backend (filesystem) does indeed get updated with new content, as well, a new commit is created in my repo. At this point, im brought back to view the updated changes. Everything is good so far. If however i choose to edit the page the second time, the previous version of the page is displayed in my the wiki.js editor.

Any ideas?

EDIT: It seems that the back end needs time to sync up. If i wait 5-10 minutes and then refresh the page, my changes are displayed. I still don't know why this happens.

wooster11 commented 5 years ago

Hey @toose11,

I'm not sure what's going on here. I gave up on my IIS deployment as I was having all other kinds of problems (subsequent comment) with it working properly with my git repo and it saving changes. Sorry, I can't be of more help here.

toose commented 5 years ago

@wooster11 Thanks anyway 👍

Chinh-P commented 5 years ago
  1. In IIS, create a new website whose virtual directory is the folder where Wiki.js was installed (e.g. C:\wiki\)

May I know why do you need to create virtual directory instead of create a website with Physical directory is C:\wiki\?

Hecatron commented 4 years ago

couple of notes for anyone else trying to get this to workk with iisnode

first I had to override the port with process.env.PORT I got that from here - https://github.com/tjanczuk/iisnode/issues/417

under server\core\config.js

    if (appconfig.port < 1 || process.env.HEROKU) {
      appconfig.port = process.env.PORT || 80
    }
    // override
    appconfig.port = process.env.PORT

next in the web.config I added a line of

<iisnode nodeProcessCommandLine="node.exe --no-deprecation --no-warnings"/>

this is due to this issue with iisnode https://github.com/tjanczuk/iisnode/issues/668