欢迎光临
我们一直在努力

Deploy Nodejs Project on CentOS

The server is php-and-mysql-available with the help of Webmin (a web-based unix system management tool). So there is no need for me to install mysql myself. What’s more, I have already a nodejs program available to run in my laptop (window OS) and the Baidu BAE (unix OS). Due to preassembled php program, the 80 port is employed and the root path for front-end files under 80 port is located in /home/username/public_html. To avoid confusion between php projects and nodejs projects, I created a new folder named “node-server” under /home/orzzone/ path. In a conclusion, I uploaded my Nodejs project files to the path ‘/home/username/node-server’.

After uploading operation was completed, I changed the current working directory to the path ‘/home/username/node-server’, and ran command “npm i” to install dependencies specified in package.json file. With all dependencies installed, I ran command “npm run start” to start my project which uses port 18080 instead of 80. All seems to go well with no error information jumped to the screen of my command line tool. But when I visited a api url through my web browser, it responsed with error information saying something as below:

Oh, what happend? The same mysql login parameter was availble for use in both my laptop and the online server provided by Baidu BAE. So I was sure that there is no error in the mysql login parameter. After half a day’s time-wasting, I found the problem. There were two anonymous mysql accounts! After I deleted the two accounts, the online nodejs program was available to communicate with mysql database normally.

A good day.

赞(0) 打赏(金额可任意指定)
未经允许不得转载:峰间的云 » Deploy Nodejs Project on CentOS
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

上海宝山顾村棉被加工店 专业加工新旧棉被

查看详情了解一下

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏