cancan
cancan

Reputation: 69

How to deploy react Remix framework to IIS on windows server 2022?

I developed an App on REMIX framework. But ı do not know how will i publish it on IIS server on Windows Server 2022. Which opitons should selected for IIS.

 npx create-remix@latest
 ? Where would you like to create your app? (./my-remix-app)
 ? Where do you want to deploy? Choose Remix if you're unsure, it's easy to change deployment targets. (Use arrow keys)
❯ Remix App Server
? TypeScript or JavaScript? (Use arrow keys)
❯ TypeScript

Upvotes: 0

Views: 1786

Answers (3)

cancan
cancan

Reputation: 69

Thanks for answers which showed me a way for found a solition.

  1. Install Node.js on Windows Server .

  2. Install IIS Node on Windows Server.

  3. Install URL Rewrite on Windows Server.

  4. Upload all files to under your web site folder on wwwroot except .cache,build,public/build,node_modules folders.(we will install them on server.)

  5. Under web site folder, type command on cmd npm install

  6. Type command npm run dev

  7. Create a web.config file main path of web site. Codes are :

    <?xml version="1.0" encoding="utf-8"?>
    <configuration> 
    <system.webServer>
    <iisnode loggingEnabled="false" nodeProcessCommandLine="C:\Program Files\nodejs\node.exe" />        
    <handlers>
    <add name="iisnode" path="/build/index.js" verb="*" modules="iisnode" />
    </handlers>  
    <security>
    <requestFiltering>
     <hiddenSegments>
       <add segment="node_modules" />
       <add segment="iisnode" />
     </hiddenSegments>
     </requestFiltering>
     </security>
     <rewrite>
        <rules>
            <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                <match url="(.*)" />
                <action type="Rewrite" url="http://localhost:3000/{R:1}" />
            </rule>
        </rules>
    </rewrite>
    </system.webServer> 
    </configuration>
    

Upvotes: 0

YurongDai
YurongDai

Reputation: 2375

The best way for the React Remix framework is to select Remix App Server, then run remix build to build the app for production, and run npm start to run the server. After performing the above operations, please treat it as a normal Node.js server, and follow the Conventional Way - deploying a node.js application on windows IIS using a reverse proxy.

  1. Install Node.js on Windows Server
  2. Deploy and test Node.js applications
  3. Create a website for our Node.js application on IIS
  4. Configure Reverse Proxy on IIS

Upvotes: 2

Kiliman
Kiliman

Reputation: 20312

Remix requires Node.js when running on Windows. You should select Remix App Server.

There are plenty of articles online on how to set up a reverse proxy on IIS. You want to proxy to RAS running on localhost:3000 (by default).

https://www.google.com/search?q=iis+nodejs+reverse+proxy

Upvotes: 1

Related Questions