我正在我的 Nginx 服务器上做一些小的压力测试。
我想知道是否有办法获得一些 Nginx 实时状态,例如连接了多少用户等等......?
谢谢你们的帮助。
干杯,朱利安
一个网站可以可靠地托管在 Amazon EC2 的微型实例上有多“大”?
运行 apache、nginx、lighty,我不在乎。
只是好奇每月 5.20 美元会让你走多远,为什么我应该或不应该走这条路。
我和我的朋友有来自同一托管服务提供商的两个相同的 CentOS 5 VPS,他使用 Apache,我使用 Nginx。他遵循了本教程,并且 vsftpd 起作用了。他尝试使用相同的程序在我的 VPS 上安装 vsftpd,但没有成功。
vsftpd 需要 Apache 才能工作吗?
我在一个共享主机上,有权继承 nginx 根安装并覆盖它的配置文件(注意:我不想在我的主目录中编译我自己的 nginx)。
我写了一个启动/重新加载/停止脚本,它运行良好,但是我不断收到以下错误
启动脚本
#!/bin/bash
# Set this to your nginx configuration file and PID
CONFIG=~/nginx/nginx.conf
PIDFILE=~/nginx/nginx.pid
# Do not change anything below unless you know what you do
DAEMON=/usr/local/nginx/sbin/nginx
NAME="nginx"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
OPTS="-c $CONFIG"
...
Run Code Online (Sandbox Code Playgroud)
我的配置:
worker_processes 4;
error_log /home/myusername/nginx/error.log;
pid /home/myusername/nginx/nginx.pid;
events {
worker_connections 8192;
multi_accept on;
use epoll;
}
http {
error_log /home/myusername/nginx/error.log;
access_log /home/myusername/nginx/access.log;
server_names_hash_max_size 8192;
server_names_hash_bucket_size 128;
include /etc/nginx/mime.types;
underscores_in_headers on;
...
Run Code Online (Sandbox Code Playgroud)
错误:
Reloading nginx configuration: [alert]: could not open error log file: open() …Run Code Online (Sandbox Code Playgroud) 来自我的两个亚马逊节点的请求进入同一个后端节点。我想弄清楚为什么?
通过谷歌搜索,我发现“散列是使用客户端地址的 C 类网络地址完成的”
如果可能的话,任何人都可以用一些例子来解释我 ip_hash 背后的算法。
我有一个包含破折号的域,例如the-domain.com,当我使用我的域的服务器名称创建服务器块并重新启动 nginx 时,我收到警告:
重新启动 nginx: nginx: [warn] server name "/var/www/domain.com/www/thedomain" 在 /etc/nginx/sites-enabled/domain.com:56 nginx 中有奇怪的符号。
所以我将域更改为我拥有的另一个域,它仍然继续从上面说同样的错误。我不明白为什么当我将其更改为合适的时会这样说?
这是重复的错误:
重新启动 nginx: nginx: [warn] server name "/var/www/domain.com/www/domaindir" 在 /etc/nginx/sites-enabled/domain.com:56 nginx 中有奇怪的符号。
我的域配置文件如下所示:
server {
server_name domain.com;
root /var/www/domain.com/www;
index index.php index.htm index.html;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
access_log /var/www/domain.com/logs/access.log;
error_log /var/www/domain.com/logs/errors.log;
error_page 404 /index.php;
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain.com/www$fastcgi_script_name;
include fastcgi_params;
}
}
server {
server_name ~^(.+)\.domain\.com$;
set $file_path $1;
root /var/www/domain.com/www/$file_path; …Run Code Online (Sandbox Code Playgroud) 我有一个 WordPress 博客,我想将所有请求重定向到某个帖子/页面,不包括 js、css(和图像)。
所以 example.com/some-post/ 必须(暂时)重定向到 exmaple.com/catch-all/
我正在玩这个,但似乎不太好用(我不确定我是否需要使用 $uri):
if ($uri !~ \.css$) {
set $redi C;
}
if ($uri !~ \.js$) {
set $redi "($redi)J";
}
if ($uri !~ /catch-all/$) {
set $redi "($redi)P";
}
if ($redi = CJP) {
rewrite ^(.*)$ https://example.com/catch-all/ last;
return 302;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将 Nginx 设置为 Apache 的反向代理,用于在 :8080 上本地运行并通过lessico.pistacchioso.com. 当前配置导致 502 - Bad Gateway 错误。
#/etc/apache2/ports.conf
Listen 127.0.0.1:8080
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
Run Code Online (Sandbox Code Playgroud)
然后
#/etc/apache2/sites-enabled/lessico
NameVirtualHost 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
ServerAdmin webmaster@localhost
ServerName lessico.pistacchioso.com …Run Code Online (Sandbox Code Playgroud) 我正在使用 Mysql 设置一个为 Magento 提供服务的 Debian 服务器。预计高负载(每天数百万次点击)。我一直在阅读各种人的评论,发现了很多不同的设置,但如果我想的话,我不知道该怎么做。多台服务器之间的负载平衡当然很好,但我只有一台服务器。那么这个怎么样?
nginx和apache前面的varnish,这里nginx只做静态数据,apache动态。
或者将清漆只放在 apache 前面会更好吗?那么 nginx 就在前面,并且通过 varnish 直接由 nginx 和动态 apache 页面提供静态数据?
这是服务器块中配置的一部分:
我无法执行任何 php 脚本,我test.php在 /var/html 下放置了一个名为的文件,但是当我指向 时http://localhost/test.php,我得到了一个结果:
File not found.,
这不是由 nginx 生成的,因为它与 nginx 的 404 页面不同。
location / {
root /var/html;
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?