I'm hosting couple of websites out of my cloud server. And I wanted to use Ghost for the 'blog' subdomain for one of the website.
I've managed to install Ghost and the Development environment works fine in localhost. However, the Production environment which now runs at 2365 port opens perfectly fine at www.blog.foobar.com:2365
I need it to open at just the www.blog.foobar.com
I've tried setting the port to 80 in the config.js and I get the Error: listen EACCES Even the ARR in IIS doesnt work. Tried almost all the steps suggested in the google search results. Reverse proxy just redirects the sub-domain to index.js
Node.js v0.10.21 x64
Ghost 0.3.3
iisnode x64
Windows Server 2012
IIS 8
Firefox
I have the port set to 2365 in config.js as if I set it to 80, it wont start at all. My IIS site binding is at port 80.
Finally figured it out with the help at the ghost forums. Assuming you have iisnode already installed and an A record for your sub-domain at your domain registrar, proceed with:
Change the web.config to as it is at Configuration File
Change the config.js production section as below
host: '127.0.0.1',
port: process.env.PORT
Leave the bindings as it is in your sub-domain IIS site settings i.e 80
Change the ENV to production in the index.js file instead of development
Enjoy Blogging :)
Here is how I did it on Windows 7.
Part of instructions are here.
Others are found here.
Install software
1) Installed node-v0.10.26-x64
2) Installed iisnode-full-iis7-v0.2.2-x64
3) Ran setupsamples.bat inside C:\Program Files\iisnode
Setup Directory
4) Removed everything inside C:\Program Files\iisnode\www
5) Extracted ghost-0.7.1 inside C:\Program Files\iisnode\www
Install Node Modules
6) Ran Node.js command prompt as administrator
7) Typed c:
8) Typed cd C:\Program Files\iisnode\www
9) "npm install --production" | command to install npm
10) Sqlite3 didn't install so had to run "npm install https://github.com/mapbox/node-sqlite3/tarball/master" to install it
Configure
11) Had to install url rewrite
12) Altered C:\Program Files\iisnode\www\config.js under development
url: 'http://localhost/blog',
port: process.env.PORT
13) still on the node.js command prompt inside C:\Program Files\iisnode\www typed "node.exe index.js" to run it
14) Removed node from iis and added application blog and pointed it to my dir C:\Program Files\iisnode\www
15) Added the web.config inside C:\Program Files\iisnode\www
<configuration>
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
<add name="WebDAV" path="*" verb="" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" />
</handlers>
<defaultDocument enabled="true">
<files>
<add value="index.js" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Ghost">
<match url="/*" />
<conditions>
<add input="{PATH_INFO}" pattern=".+\.js\/debug\/?" negate="true" />
</conditions>
<action type="Rewrite" url="index.js" />
</rule>
</rules>
</rewrite>
<!--
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for information regarding iisnode specific configuration options.
-->
<iisnode node_env="%node_env%" loggingEnabled="false" debuggingEnabled="false" devErrorsEnabled="false" />
</system.webServer>
</configuration>
Related
I use IIS in Windows to run several web page servers.
And this time, I studied Nuxt.js.
Build a project created with Nuxt.js using the "npm run build" command.
I know that if you go into that folder and "npm run dev", the server opens on port 3000.
At this time, instead of "http://example.com:3000" on the web browser, I would like to launch the service through "http://example.com".
How shall I do it?
Is there a way to set it up in IIS Manager?
If not, should we consider a new web server instead of IIS?
If not, is there a way to set it up in Nuxt.js?
I tried the HTTP redirection feature in IIS Manager, but I could not get the desired result.
If you want to access the website on port 3000 by entering "http://example.com" in the browser address bar, you can do it through IIS reverse proxy.
First of all, you need to install URL Rewrite module and ARR module on IIS.
Then you need to double-click the Application Request Routing Cache on the server level, and select "Server Proxy Settings" on the right tree node, check "Enable Proxy" and apply.
According to your description, you need to have two websites on your IIS, one is the default website (port 80), and the other is the application website you deployed to IIS (port 3000). Next you need to create a rewrite rule on the default website, as follows:
<rewrite>
<rules>
<rule name="test" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://example.com:3000/{R:1}" />
</rule>
</rules>
</rewrite>
By the above method, you can access your application through the URL: "http://example.com".
With HttpPlatformHandler you can easily host Nuxt.js web apps on IIS, but changes to your project are required as below,
Nuxt 2.x
The official guide to host Nuxt 2.x for Azure App Service (Windows) shows the general hints,
Create server\index.js.
Modify nuxt.config.js.
but it misses important steps,
You must add express and nuxt-start as dependencies (check your package.json).
Change const nuxt = await loadNuxt(isDev ? 'dev' : 'start') to simply const nuxt = await loadNuxt('start'), as isDev isn’t defined anywhere.
Then your web.config should look similar to,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\node.log" startupTimeLimit="20" processPath="C:\Users\<user name>\AppData\Roaming\nvm\v16.13.2\node.exe" arguments=".\server\index.js">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Note that iisnode mentioned in that Nuxt.js guide is no longer maintained, and only HttpPlatformHandler is recommended.
Note that rewrite rules in official guide were not added as the minimal sample project does not require them, but you can add them for your project if needed.
Nuxt 3.0
The steps are simplified,
npx nuxi init test-nuxt
cd test-nuxt
npm install
npm run build
with web.config,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\node.log" startupTimeLimit="20" processPath="C:\Users\<user name>\AppData\Roaming\nvm\v16.13.2\node.exe" arguments=".output\server\index.mjs">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Reference
My blog post on Nuxt 2.x
My blog post on Nuxt 3.0
Nuxt.js for Azure guide
I use IIS in Windows to run several web page servers.
And this time, I studied Nuxt.js.
Build a project created with Nuxt.js using the "npm run build" command.
I know that if you go into that folder and "npm run dev", the server opens on port 3000.
At this time, instead of "http://example.com:3000" on the web browser, I would like to launch the service through "http://example.com".
How shall I do it?
Is there a way to set it up in IIS Manager?
If not, should we consider a new web server instead of IIS?
If not, is there a way to set it up in Nuxt.js?
I tried the HTTP redirection feature in IIS Manager, but I could not get the desired result.
If you want to access the website on port 3000 by entering "http://example.com" in the browser address bar, you can do it through IIS reverse proxy.
First of all, you need to install URL Rewrite module and ARR module on IIS.
Then you need to double-click the Application Request Routing Cache on the server level, and select "Server Proxy Settings" on the right tree node, check "Enable Proxy" and apply.
According to your description, you need to have two websites on your IIS, one is the default website (port 80), and the other is the application website you deployed to IIS (port 3000). Next you need to create a rewrite rule on the default website, as follows:
<rewrite>
<rules>
<rule name="test" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://example.com:3000/{R:1}" />
</rule>
</rules>
</rewrite>
By the above method, you can access your application through the URL: "http://example.com".
With HttpPlatformHandler you can easily host Nuxt.js web apps on IIS, but changes to your project are required as below,
Nuxt 2.x
The official guide to host Nuxt 2.x for Azure App Service (Windows) shows the general hints,
Create server\index.js.
Modify nuxt.config.js.
but it misses important steps,
You must add express and nuxt-start as dependencies (check your package.json).
Change const nuxt = await loadNuxt(isDev ? 'dev' : 'start') to simply const nuxt = await loadNuxt('start'), as isDev isn’t defined anywhere.
Then your web.config should look similar to,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\node.log" startupTimeLimit="20" processPath="C:\Users\<user name>\AppData\Roaming\nvm\v16.13.2\node.exe" arguments=".\server\index.js">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Note that iisnode mentioned in that Nuxt.js guide is no longer maintained, and only HttpPlatformHandler is recommended.
Note that rewrite rules in official guide were not added as the minimal sample project does not require them, but you can add them for your project if needed.
Nuxt 3.0
The steps are simplified,
npx nuxi init test-nuxt
cd test-nuxt
npm install
npm run build
with web.config,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\node.log" startupTimeLimit="20" processPath="C:\Users\<user name>\AppData\Roaming\nvm\v16.13.2\node.exe" arguments=".output\server\index.mjs">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Reference
My blog post on Nuxt 2.x
My blog post on Nuxt 3.0
Nuxt.js for Azure guide
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
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
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.
Install Node.js on Windows Server
Deploy and test Node.js applications
Create a website for our Node.js application on IIS
Configure Reverse Proxy on IIS
Thanks for answers which showed me a way for found a solition.
Install Node.js on Windows Server .
Install IIS Node on Windows Server.
Install URL Rewrite on Windows Server.
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.)
Under web site folder, type command on cmd npm install
Type command npm run dev
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>
I have created Node.js application on Visual studio 2019, and I want to deploy it on IIS.
How I can deploy node.js application and Node.js express applications on IIS on local system
I have tried many solutions but none of them completely helpful
The link below some how helpful but confusing and lot of content to read
https://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx
Here some simple solution for above problem
Node.js deplyment on iss
Install IISNODE
open cmd as admin
cd "C:\Program Files\iisnode" (or "C:\Program Files (x86)\iisnode" if you installed the 32bit version
Type setupsamples.bat
Install MS URL rewrite using web installer
add web.config with code
<configuration>
<system.webServer>
<!-- indicates that the server.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sendToNode">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
publish node.js project
paste published site on inetpub-->wwwroot
run cmd as admin
run command on website folder
For node
npm install
For Node Express
npm install express
Create IIS website
start browsing
I'm wondering if anyone could help with getting a sails JavaScript app running in IIS 7 on Windows.
https://github.com/tjanczuk/iisnode/issues/298 did not prove to be helpful for me.
I have gone through the iisnode setup and created this as my web.config file:
<configuration>
<system.webServer>
<!-- Tell IIS to use the iisnode module to run your
application -->
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<!-- Add iisnode with the #nodeProcessCommand line if
you see the error: Make sure the node.exe executable
is available at the location specified in the
system.webServer/iisnode/#nodeProcessCommandLine element
of web.config. -->
<iisnode
nodeProcessCommandLine="%ProgramFiles%\nodejs\node.exe"
/>
<!-- Since behind the covers, Sails.js is just an express app
rewrite all urls to processed by iisnode via app.js. This
will sort out things like the routing to your public
resources (images, js, styles) and all configured rest
endpoints. -->
<rewrite>
<rules>
<rule name="root">
<match url=".*" />
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sails is installed and when I run the server from the terminal sails lift I can access the app at http://localhost:1337/, but when I attempt to access it through the IIS port8090 I receive a HTTP 500 with the message:
To run an app using node app.js, you usually need to have a version of sails installed in the same directory as your app.
To do that, run npm install sails
Alternatively, if you have sails installed globally (i.e. you did npm install -g sails), you can use sails lift.
When you run sails lift, your app will still use a local ./node_modules/sails dependency if it exists,
but if it doesn't, the app will run with the global sails instead!