我安装了nginx 1.0.8.这是我的问题:我有2个文件:file1.js和file2.js.请求的路径是这样的:
www.mysite.com/files_dir/%user%/file.js
如果请求的标题:" X-Header "存在且值为" OK ",则响应的内容应为file1.js else file2.js.
这些文件位于" html/files_dir "中,%user%是一组目录,表示通过我的服务注册的用户名.
如何在nginx中配置?我对php,asp或类似技术不感兴趣只有在nginx可能的情况下才有意义.
谢谢
我开发了一个基于ajax的web应用程序,带有哈希爆炸网址.
我试图将请求从搜索引擎重定向到另一个生成HTML快照并发送响应的服务器.我试图在nginx中使用location指令实现这一点,如下所述:
location ~ ^(/?_escaped_fragment_=).*$ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 60s;
proxy_send_timeout 90s;
proxy_read_timeout 90s;
proxy_buffering off;
proxy_temp_file_write_size 64k;
proxy_pass http://x1.x2.x3.x4:8080;
proxy_redirect off;
}
Run Code Online (Sandbox Code Playgroud)
但我无法让这个工作.有人可以纠正我正在使用的正则表达式(或)为我提供替代解决方案来实现这一目标.
提前致谢.
我正在努力减少Apache在服务器上的内存使用量.
我实际每个孩子的最大连接数是10k
根据以下建议
每个孩子的最大连接数应减少到1000
http://www.lophost.com/tutorials/how-to-reduce-high-memory-usage-by-apache-httpd-on-a-cpanel-server/
Apache配置中每个子连接最大连接数的建议最大值是多少?
如果主机是 dev.example.com 或 test.example.com,我想告诉 Apache 2.4.9 要求有效用户。这不起作用:
AuthType Basic
AuthName "Speak, friend, and enter."
AuthBasicProvider file
AuthUserFile /sites/example/conf/.htpasswd
AuthGroupFile /dev/null
SetEnvIfNoCase Host ^dev\.example\.com$ env_is_protected
SetEnvIfNoCase Host ^test\.example\.com$ env_is_protected
Require valid-user
Require not env env_is_protected
Run Code Online (Sandbox Code Playgroud)
在以下示例中,前五行始终与第一个示例中的相同。
这不起作用:
SetEnvIfNoCase Host ^dev\.example\.com$ env_is_protected
SetEnvIfNoCase Host ^test\.example\.com$ env_is_protected
<RequireAny>
Require valid-user
<RequireNone>
Require env env_is_protected
</RequireNone>
</RequireAny>
Run Code Online (Sandbox Code Playgroud)
它会导致服务器错误。该文档解释:
因为否定授权指令无法返回成功的结果,所以它们不能显着影响 <RequireAny> 指令的结果。(在它们失败并且所有其他指令返回中性值的情况下,它们最多可能导致指令失败。)因此,在 <RequireAny> 指令中不允许使用否定授权指令。
这不起作用:
SetEnv env_is_unprotected 1
SetEnvIfNoCase Host ^dev\.example\.com$ !env_is_unprotected
SetEnvIfNoCase Host ^test\.example\.com$ !env_is_unprotected …Run Code Online (Sandbox Code Playgroud) apache .htaccess server-configuration httpd.conf basic-authentication
我在带有 nginx/passenger/WebRick/ 的 Ubuntu 14.04 服务器中的rails 应用程序上部署了我的ruby(使用 rbenv),当我在生产环境中运行服务器时,该站点完美呈现,没有任何问题,但是当我退出 ssh 连接时,网站呈现空白,没有错误,只是一个空白的白页。
当我重新建立 ssh 连接时,即登录到服务器,我完全获得了页面!
日志,给了我这个错误,
Errno::EACCES(权限被拒绝@dir_s_mkdir - /home/username/appname)
错误日志截图:
http : //postimg.org/image/iolw2rwdr/
http://postimg.org/image/phsel5skd/
server-configuration ruby-on-rails passenger nginx ruby-on-rails-4
我有一个简单的 django 网站,我正在尝试加载 nginx 和 uwsgi 。
当我尝试测试我的 nginx 配置时,我得到以下信息:
$ sudo nginx -t
nginx: [crit] pread() "/etc/nginx/sites-enabled/sites-available" failed (21: Is a directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
Run Code Online (Sandbox Code Playgroud)
我的站点可用/默认配置如下所示:
# the upstream component nginx needs to connect to
upstream django {
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve …Run Code Online (Sandbox Code Playgroud) 今天我安装了SQL Server.我试图从SQL Server的应用程序连接.但连接失败了.我试图telnet到以下
telnet 127.0.0.1 1433
Run Code Online (Sandbox Code Playgroud)
但是我得到了以下信息:

注意:我试图ping它是成功的.
我需要信息在SQL Server上启用端口号1433.我正在使用SQL Server 2008客户端(管理工作室)和SQL Server 2008 Express引擎.
谢谢
我正在使用 Laravel 5.2 和 Nginx,并且在我的开发服务器上运行良好。
例如:
http://example.com/results?page=2
Run Code Online (Sandbox Code Playgroud)
开发服务器
LengthAwarePaginator::resolveCurrentPage(); // returns 2
Paginator::resolveCurrentPage(); // returns 2
$request->input('page'); // returns 2
Run Code Online (Sandbox Code Playgroud)
但是在生产服务器中
LengthAwarePaginator::resolveCurrentPage(); // returns 1
Paginator::resolveCurrentPage(); // returns 1
$request->input('page'); // returns null
Run Code Online (Sandbox Code Playgroud)
生产服务器配置
server {
listen 80 ;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html/laravel/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.php;
}
location @rewrite {
rewrite ^(.*)$ /index.php?_url=$1;
}
location ~ \.php$ {
try_files $uri $uri/ …Run Code Online (Sandbox Code Playgroud) 我需要 sp_configure 来在 MS SQL 中运行 R 脚本。但每当我尝试运行“ EXECUTE sp_configure ”或“ exec sp_execute_external_script ”之类的内容时,它都会说“找不到存储过程“sp_configure”。' 和'sp_execute_external_script' 失败,因为此 SQL Server 实例 'A5DC0B2838AC' 的版本不支持它。有关不同 SQL Server 版本中功能支持的更多详细信息,请参阅在线书籍。'
我什至尝试创建系统存储过程 sp_config 但在过程“ EXEC %%ServerConfiguration( ConfigID = @confignum ).SetValue( Value = @configvalue ) ”的这一行出现错误,并且错误是“%”附近的语法不正确
我将我的 Symfony3 应用程序从共享主机移到了我刚刚设置的新 VPS。当我尝试登录应用程序(使用随意的 FOSUserBundle 表单)时,Symfony 确实登录我只是为了在下一页重新加载时断开我的连接。这是“立即”,因为成功登录所做的第一件事就是重定向到一个页面。
我试过的:
我正在使用 Symfony 3.4.6 和 FOSUB 2.0.0。任何的想法?
更新:Security.yml
# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
check_path: fos_user_security_check
failure_path: fos_user_security_login
login_path: /fr/public/login
default_target_path: app_homepage
logout:
path: fos_user_security_logout
target: fos_user_security_login
anonymous: true
access_control:
# Allow anonymous …Run Code Online (Sandbox Code Playgroud) nginx ×5
apache ×2
php ×2
.htaccess ×1
connection ×1
django ×1
httpd.conf ×1
laravel ×1
passenger ×1
port ×1
r ×1
sql-server ×1
symfony ×1
symfony-3.4 ×1
uwsgi ×1