This brings up a tricky situation. ==> I develop my apps on my Host Windows 7 Pro x64 environment, using Sublime Text 3 primarily. ==> This host has a share: "dev" located at c:\dev ==> In that share, I have a folder 'web-root', which contains a folder for each website I'm working on, so let's just say there's 1 in there called " domain.com" ==> Also in c:\dev is a folder 'web-server', which I created a series of subfolders for: 'c:\dev\web-server\nginx\conf\', here I put all the config files that comes with NGINX (including the nginx.conf file) ==> The whole c:\dev is shared with my VM Ubuntu (which is located at /media/sf_dev. I similarity sake, I created a symlink in my home directory called 'dev' which pointed to /media/sf_dev, and sure enough, I can see the 'web-root' and 'web-server' folders that are actually on my host machine. ==> I need to figure out how to tell NGINX, which auto-boots on Ubuntu to use the nginx.conf which is located at /media/sf_dev/web-server/nginx/conf/nginx.conf (or /home/aaron/dev/web-server/nginx/conf/nginx.conf) ==> I do this because from Windows I want to be able to configure all relevant files I need to in order to configure the guest (Ubuntu) environment from my Host (where my editor is). I just want to use the guest environment for emulating being a web server.
I found out that I had to modify my virtual machine's network adapter to act as a bridge so that I can test my web server (NGINX on Ubuntu) from my host machine. I gave it a static 10.x.x.x address, changed the network adapter from 'host-only/NAT' to 'bridged' and now from my Windows PC, with NGINX up, I can modify my hosts file so that, say 'domain.local' goes to the 10.x.x.x address, and sure enough, the page is served (of course, this stopped working once I moved the .conf file, but I'm sure I'll be able to specify a different config folder location somehow. Whew! And that's how I'm setup. Hopefully I made sense, but I thought you should get a big picture view. On Mon, Sep 14, 2015 at 10:45 AM, Aaron Martone <[email protected]> wrote: > Interesting. I'd love to pick your brain about best practices with > ensuring delivery of my NGINX and Node Apps. > > My production environment is running Ubuntu 14.04, and my local > development environment is running Ubuntu 14.04 emulated on VirtualBox on a > Windows 7 Pro x64 host machine. > > Recently I learned how to parse command line arguments given to the node > process so that I can indicate to my node app whether I want to run it in a > set environment (development/staging/production) or to let it look for the > NODE_ENV local environment variable, or default to development if not > specified. But ensuring that NGINX and the Node apps auto run on server > start; I never even gave that much thought! > > I've recently downloaded PM2 and am reading up on documentation for it to > ensure that specified Node apps are run when the server starts. It also > ensures that if the apps crash, they are restarted (go availability!). But > as for NGINX. My OSX laptop is mostly for development when I'm out of the > house. Otherwise I'm developing "through" Windows on Ubuntu (I gave my > virtual machine 2 of 6 cores, 4 of 16GB RAM and 100GB of 500GB as far as > resources go, so it more than emulates my hosts's 2-core, 1GB, 30GB > instance. But if you have information on how to setup NGINX to auto-start > on server boot, I'd love to hear that. > > > On Mon, Sep 14, 2015 at 12:07 AM, Ryan Schmidt <[email protected] > > wrote: > >> >> On Sep 9, 2015, at 8:53 AM, Aaron Martone wrote: >> >> > And for clarification, what you're saying about the Node/App side of >> things, can you throw me a hint or 2 about some tech used for more >> automated assurances to run my apps? Are we talking about things like >> Forever, or services that work to constantly ensure that if the Node >> process dies, it is spun back up without my need to manually do it? >> >> If you're just testing a node app, you can start it on the command line, >> no problem. >> >> If you want that app to run a production web site, you'll want to take >> care of two things: >> >> 1. starting your node app when the your boots (even if you don't plan to >> reboot your vps ever, it might reboot for reasons outside of your control, >> including the whims of your hosting provider and unexpected power loss) >> >> 2. restarting your node app if it quits (most node apps are designed to >> quit when they encounter an unexpected situation, and also your app might >> crash) >> >> On OS X, launchd would handle both of those things, if asked to do so via >> a config file (plist) that you would write. On Linux variants that use >> systemd, it would handle both, again if so configured. AFAIK the majority >> of Linux variants do not use systemd, so you may need to handle these two >> things separately, using whatever facilities are built into your flavor of >> Linux, or using other tools. I don't use Linux so I can't guide you >> specifically. >> >> -- >> Job board: http://jobs.nodejs.org/ >> New group rules: >> https://gist.github.com/othiym23/9886289#file-moderation-policy-md >> Old group rules: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "nodejs" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/nodejs/8yH6BbvHBrw/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/nodejs/A1310D89-008C-4E95-A1E6-07996A3734EC%40ryandesign.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAA05c7%2BJQ1gu-AiJUS_2FdtxjTg%2BPZvOSgVO7t_7zjnmdZQqFg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
