问题标签 [server-administration]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
594 浏览

php - NodeJS port proxy or Apache redirect - which is most efficient for my development workflow?

I have a dedicated VPS running ZPanel (a managed LAMP stack installation) on Ubuntu. This allows me to easily add domains and PHP websites to my server and have each of them sandboxed to different ftp logins + mysql users which is pretty awesome.

Today I started messing around with some NodeJS apps. I was really impressed with the speed of these apps so I thought I'd throw them on my server. I created a new hosting account within zpanel as per usual, then started the app within an SSH terminal. As expected, the NodeJS app runs smoothly and I can still update its code via a separate FTP login just like I can with my existing PHP sites - fantastic!

All good up to here, but now comes the tricky part: getting NodeJS and Apache running in parallel on the same server...

The problem is that my NodeJS app runs on port 8080 (user defined) and Apache runs on port 80 (by default)

e.g. http://domain.com/:8080 <-- having the port in the url is obviously pretty confusing for users.

What would be the best solution to have any new nodejs apps & PHP websites accessible from http://newdomain.com/ as well as any existing PHP websites accessible from http://domain1.com/ , http://domain2.com/ or http://domain3.com/ instead of using the port?

These are the options I have come up with so far:

  1. Creating a 'sites-available' file on Apache for each domain that runs a Node app (ZPanel doesn't create this file by default). I'm guessing this is the simplest option but I've read that proxying from apache to Node is a speed & performance bottleneck as Apache is spawning additional processes on each request and then Node is doing its processing too.

  2. Changing all Apache websites to run off port 8080 and making Node run on port 80 instead. Then running a proxy with Node (on port 80 - the default http port) which would redirect a client to the correct url + port depending on the domain they visit. (Is it possible to run a node app globally for all domains attached to a server?) This seems like the most time consuming option, but wouldn't performance be greatly improved and my current hosting architecture would remain running pretty well?

  3. Any other option that I haven't thought of?

Remember: I am running every website (Node or PHP) on a different domain. I haven't come across a solution as sophisticated as this yet so I thought it'd be quite an interesting question as I'm sure a few others would be interested in a workflow like this (especially with git integrated!)

Please ask if further explanation is needed with this question and I will make edits if necessary.

Thanks in advance.

0 投票
1 回答
43 浏览

php - 每当使用 php 在网站上发生意外事件时,如何创建自定义错误页面?

我正在 Apache Web 服务器上使用 PHP 进行开发。我想知道是否有办法强制服务器在发生以下任何事件时提供自定义错误页面:

  • 用户正在寻找的页面不存在(我想提供自定义错误页面而不是经典的“404 Not Found”);
  • 用户更改了 value='' 属性的值或 name='' 属性的值,然后发送带有错误值的表单(例如,我有一个其中 value 属性表示产品的 id,即将被购买或数据库中将被取消的单义行。我想防止模棱两可的行为,例如当用户从“检查元素”浏览器工具更改值属性,然后提交表单时;
  • 用户更改了?query_string=value,然后点击了一个链接或提交了一个action 属性设置为“page.php?query_string=value”的表单。

因此,每当发生任何这些模棱两可的事件时(我知道用户在购买某些东西时更改输入元素的属性值可能看起来很愚蠢,但谁知道呢)我想抛出一个类似 facebook 上的页面例如,当您尝试访问https://www.facebook.com/hello.php时手指骨折。

我怎样才能做到这一点?我需要配置一些东西还是我可以直接用 PHP 来做?

感谢问候!

0 投票
1 回答
30 浏览

server-administration - 在多个服务器实例之间同步文件

使用多台服务器的站点必须有某种方法来处理将更新推送到所有 Web 服务器,而不必单独将文件传输到每个服务器。

我正在寻找一种解决方案来管理多台机器上的多台服务器,但能够向它们推送更新,而无需手动将文件传输到每个实例。

我不确定这是否是问题的正确位置,但如果不是,请将我链接到更合适的网站。

谢谢。

0 投票
1 回答
14640 浏览

apache - Apache2 中 ServerAdmin 指令的好处

ServerAdminApache2 中的指令究竟如何有用?

Apache2 文档如下:

ServerAdmin 设置服务器在返回给客户端的任何错误消息中包含的联系地址。

但是每当我收到 404 错误时,我的虚拟主机中设置的电子邮件地址就无处可寻。我是否需要一些额外的指令才能使其工作?

虚拟主机:

0 投票
2 回答
1185 浏览

database - 如何使用仅匹配特定模式的表创建 oracle 模式转储

我想将架构的 AB% 和 AC% 表从一台服务器传输到 oracle 中的另一台服务器。

如何创建仅包含名称以 AB 和 AC 开头的表的转储。

我已经尝试过这个命令,但它会将架构中的所有表转储到 dmp 文件中。

0 投票
0 回答
37 浏览

django - 如何自定义 Django 管理界面指向的 URL?

我有一台在 Apache 代理后面的 127.0.0.1:8000 上运行 Django 的 Gunicorn 服务器的服务器。这适用于大多数用途,但 Django 管理界面在编辑模型内容时会保存更改,然后重定向到http://localhost:8000/abc/xyz离开,以使用户产生轻微的混淆。(在这种情况下,用户是一些受信任的用户,因此如果必须,我可以通过用户教育来解决这个问题,但我宁愿不必这样做。)

我如何要求 Django 管理界面将其基本 url 视为http://domain.com/并在编辑模型实例后将用户引导到适当的内容?

0 投票
1 回答
1337 浏览

oracle - 有没有办法用 eScript 找出对象管理器的名称?

基本需要是确定当前运行任务的对象管理器的名称。如果我们还可以获得任务 ID、组件名称(通常)、组件组名称、服务器名称和企业名称,那么额外的好处将是。

实际上这里提供了一个解决方案但它有严重的局限性。只要它使用纯内存对象且不支持示例查询的 Server Admin buscomps,我们就必须遍历所有记录。这可能会导致具有数百甚至数千个活动任务的生产服务器出现性能问题。有没有其他方法可以获取这些信息?

0 投票
2 回答
1354 浏览

php - 将 /download URI 重定向到同一域上的子域

我完成了一个应用程序,该应用程序具有一个由 NGINX 托管的下载系统:

http://dashboard.myapp.com

下载地址为:

http://dashboard.myapp.com/download/file-slug

这个页面是一个常规的 PHP 页面,需要一些用户输入,然后 PHP 处理实际的文件下载,它不是文件的直接路径。

由于这些下载 URL 将公开可用,因此我想放弃该仪表板子域。

默认域 (myapp.com) 已经在使用 wordpress 设置:

有没有简单的方法来获得:

http://myapp.com/download/file-slug

表现得好像:

http://dashboard.myapp.com/download/file-slug

被访问,没有实际重定向?

0 投票
1 回答
1220 浏览

mysql - MySQL slave 上的慢查询

让我们假设一个系统有一个 MySQL 主服务器和一个从服务器。

主服务器上发生了很多读写操作,我选择在从服务器上执行繁重的慢速查询。

会发生什么?主服务器会显示一些减速吗?

0 投票
1 回答
252 浏览

node.js - 使 node.js 应用程序在 ubuntu 服务器上运行

我创建了一个非常简单的节点应用程序,它在我的本地环境中完美运行。

该应用程序正在侦听端口 8000,例如:

在我的本地环境中,我可以访问节点应用程序,例如:

但是,当我试图让它在我的 linode 服务器(Ubuntu 10.04)上运行时,我无法访问节点应用程序:

我确定我有所有的 node_modules,因为当我这样做时

它不返回任何错误消息,并且看起来它正在运行。

我在想可能是因为我为http://mydomain.com设置了 apache2 ,我应该进行某种代理设置,或者这可能是一些我根本不知道的问题。我真的一无所知,我在谷歌上找不到任何相关文档...我知道中间肯定有很多我不明白的东西...请帮助我了解如何部署 node.js 应用程序到服务器。非常感谢大家