In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces ubuntu how to deploy the nodejs site, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Log in to the machine ssh ubuntu@119.29.237.x
Log in with a username and password for the first time, and then configure password-free login for ssh
Nginx installation
Install nginx using apt-get
Sudo apt-get install nginx
This is the easiest way, but this is not the latest nginx. If you need to support http2, you need at least nginx 1.9.5, so we chose to compile the latest nginx installation locally.
Wget https://nginx.org/download/nginx-1.10.1.tar.gztar-xvf nginx-1.10.1.tar.gzcd nginx-1.10.1# installation compilation depends on sudo apt-get install make libssl-dev zlib zlib-devel zlib1g-dev openssl openssl-devel pcre-devel\ libpcre3-dev libpcre++-dev# compilation installation. / configure-- with-http_ssl_module-- with-http_realip_module-- with-http_addition_module-- With-http_sub_module\-with-http_dav_module-- with-http_flv_module-with-http_mp4_module-- with-http_gunzip_module\-- with-http_gzip_static_module-- with-http_random_index_module-- with-http_secure_link_module\-- with-http_stub_status_module-- with-http_auth_request_module-- with-mail-- with-mail_ssl_ Module\-with-file-aio-- with-ipv6-- with-cc-opt='-O2-g-pipe-Wp -D_FORTIFY_SOURCE=2-fexceptions-fstack-protector-- param=ssp-buffer-size=4-M64-mtune=generic'\-- after with-http_v2_modulemakesudo make install#, nginx will be installed to the / usr/local/nginx directory # create a nginx command soft connection sudo ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin/nginx# and then run the `nginx` command nginx-V# configure nginx automatically under Load the init.d/nginx file sudo wget https://raw.githubusercontent.com/JasonGiedymin/nginx-init-ubuntu/master/nginx-O / etc/init.d/nginxsudo chmod + x / etc/init.d/nginx# add boot automatically start sudo update-rc.d-f nginx defaults# start sudo / etc/init.d/nginx start # sudo / etc/init.d/nginx stop # stop # sudo / etc/init.d/nginx restart # restart mongodb installation
Mongodb can be installed directly using apt-get
Sudo apt-get install mongodb# add Boot Auto start sudo update-rc.d-f mongodb defaults# launch sudo / etc/init.d/mongodb startnode installation # download the compiled node wget https://nodejs.org/dist/v4.6.0/node-v4.6.0-linux-x64.tar.xztar-xvf node-v4.6.0-linux-x64.tar.xzcd node-v4.6.0-linux-x64.tar from the node official website. Xz# copy install sudo cp-r bin include lib share / usr/local/# node command to test node-vserver deployment
Preparatory work:
# create directory sudo mkdir-p / data/www/ivweb.io# create user sudo groupadd www# create user # nginx also use this user to run sudo useradd www-g www-d / data/www# / data directory permissions sudo chown www:www / data# install foreversudo npm install-g forever
Use the rsync command locally to synchronize files to the server (Linux/Mac,windows students need to install this command first)
Rsync-rtzvlC-exclude node_modules-exclude ".git"\. / "www@ivweb.io:/data/www/ivweb.io"
Start the service
# using www login server cd / data/www/ivweb.io# to install dependent npm install# forever startup appforever start app.js#, you can use `forever list` to view the operation and corresponding log output files, and `tail-f` to dynamically view logforever list# tail-f XXX.log
After configuring the nginx mapping, restarting the nginx machine is complete:
Thank you for reading this article carefully. I hope the article "how to deploy the nodejs site in ubuntu" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Virtual machine mount CD configuration yum source *
© 2024 shulou.com SLNews company. All rights reserved.