我想为Debian服务器上的less量不受信任的PHP网站设置安全的环境。 现在所有的东西都运行在同一个Apache2上,mod_php5和vsftpd用于pipe理文件访问,所以还有改进的空间。 这个想法是使用nginx而不是apache,SFTP通过OpenSSH而不是vsftpd和chroot(在sshd_config中),每个网站的个人用户拥有自己的PHP进程池。 所有这些用户和nginx都是同一个组的一部分。 现在理论上我可以在所有PHP脚本上设置700个权限,而在Nginx必须提供的静态文件上设置750个权限。 从理论上讲,如果一个网站遭到破坏,所有其他用户的数据都是安全的,对吗? 是否有更好的解决scheme,每个网站需要更less的设置时间和内存? 干杯
我试图让我们的用户能够下载一个使用php强制下载的zip文件。 我在下载完成时遇到了麻烦,事实certificatezip文件被压缩并发送到浏览器,然后内容长度标题会在下载完成之前停止下载(因为压缩zip文件会使文件变大)所以我把这个添加到我的代码中: if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } 添加完后,可以打开下载的zip文件,但Content-Length文件头不再被发送。 我检查了使用萤火虫发送的标题,下载不再有进度条。 我不确定是否下载正在工作,因为它们不再被gzip压缩,或者由于内容长度头不再被发送(而且更大的gzip文件正在被完全下载)。 我也想知道为什么添加这三行会导致内容长度标题消失? 这里是强制下载的部分: if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } // Display the download ob_end_clean(); header('Content-Description: File Transfer'); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="'.$name.'.zip"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($archive)); flush(); readfile($archive);
我需要将这个.htaccess转换为Nginx格式,如果可以的话,请指导我。 DirectoryIndex index.php FileETag none ServerSignature Off Options All -Indexes <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^([0-9a-zA-Z]{1,6})$ links/?to=$1 [L] RewriteRule ^([0-9]{1,9})/banner/(.*)$ links/?uid=$1&adt=2&url=$2 [L] RewriteRule ^([0-9]{1,9})/(.*)$ links/?uid=$1&adt=1&url=$2 [L] </IfModule> 再次感谢…
我想知道在EC2上应该使用什么实践来创build安全和弹性的Rails和MySQL服务器。 更具体地说,当我说“安全和弹性”时,我试图平衡一个事实,即我需要使用dm-crypt保护块级安全EBS存储上的数据(包括MySQL数据和Rails日志)。 为了确保安全,我不愿意以明文方式存储密码。 问题当然是,如果服务器重新启动,encryption的文件系统不能自动挂载,这意味着我也不能自动启动mysqld / nginx / passenger /等。 另一方面,我正在寻找一种灵活的解决scheme,即通过人工干预和自动化的组合,可以快速恢复故障(如暂时丢失存储或EC2实例故障)。 我唯一的select是创build一个手动调用的shell脚本来挂载encryption的EBS卷,然后启动相应的服务器进程? 还是有一些更复杂的密钥pipe理工具,可能能够以安全的方式自动化这个过程? 他们在生产服务器环境中为这种情况做了什么?
我有三台服务器,负载平衡器运行nginx,并将PHP请求上传到运行php-fpm的两台服务器之一。 实际上,我试图首先testing并发性,因此每个PHP-FPM服务器上的php脚本显示开始和结束时间以及主机名,并且在启动时间被回显之后,它使用100%CPU 5秒钟回应结束时间。 两个服务器都不能同时对4个并发请求命中100%CPU,并且时间戳显示它们连续服务,这让我觉得nginx和fastcgi会阻塞所有并发连接。 使用100个并发连接运行ab可以在一个PHP-FPM服务器上(全部10个可用)处理所有进程,而另一个服务器完全无所事事。 nginx conf是: upstream backend { server 192.168.1.60:9000; server 192.168.1.61:9000; } server { listen 80; server_name localhost; access_log /var/log/nginx/localhost.access.log; location / { root /var/www; index index.php; } location ~ .php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; include fastcgi_params; } }
我试图安装phpmyadmin与我的archilnux框中的nginx工作,但我似乎有一些问题。 以下步骤正是我所做的: sudo pacman -S phpmyadmin 然后我创build一个完全像维基的符号链接: sudo ln -s /usr/share/webapps/phpMyAdmin /srv/http/<domain>/public_html/phpmyadmin 卷发返回: curl -I http://localhost/phpmyadmin HTTP/1.1 301 Moved Permanently Server: nginx/1.0.5 Date: Tue, 16 Aug 2011 16:57:54 GMT Content-Type: text/html Content-Length: 184 Location: http://localhost/phpmyadmin/ Connection: keep-alive 当我尝试通过铬访问时收到的是: Server error The website encountered an error while retrieving http://localhost/phpmyadmin/. It may be down for maintenance or […]
我正在build立一个新的Web服务器,并想知道以下是一个有效的堆栈: 在前面清理caching和拆分静态内容的nginx和Apache与mod_php之间的dynamic内容之间的stream量。 我也将运行APC作为PHP的操作码caching和作为数据caching的memcached。 这是一个有效的configuration? 如果我的一些PHP已经被Varnishcaching,是否需要打扰运行APC?
我有这样的configuration: worker_processes 2; error_log logs/error.log; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 64; access_log logs/access.log; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 75 20; gzip on; gzip_comp_level 1; gzip_proxied any; gzip_min_length 1100; gzip_buffers 4 8k; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; server { listen 80; server_name […]
我正在转换一个Web应用程序从Apache到Nginx。 在Apache的httpd.conf中我有: ProxyPass /proxy/ http:// ProxyPassReverse /proxy/ http:// 这个想法是客户发送这个url: http://web-server-domain/proxy/login-server-addr/loginUrl.php?user=xxx&pass=yyy 和Web服务器调用: http://login-server-addr/loginUrl.php?user=xxx&pass=yyy 我的nginx.conf附在下面,它不工作。 目前看起来它正在调用服务器,但返回一个应用程序错误。 这似乎很有希望,但任何尝试debugging失败! 我不能跟踪任何的调用,因为nginx拒绝把它们放在错误文件中。 另外,在login服务器上放置echo语句并没有帮助哪个是奇怪的。 nginx文档对此没有太大的帮助。 任何关于如何configurationproxy_pass的build议? 谢谢! user nginx; worker_processes 1; #error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] "$request" ' '$status $body_bytes_sent […]
我目前有一个生产网站,在s3上拥有大容量的50GB图像。 对于我的分段环境,我首先将生产桶克隆到一个分段桶中,但是这已经变得太大而无法维护。 分段时发生的变化必须继续与分段环境隔离,而不能触及生产。 将缺失的分段资产redirect到生产的最佳select是什么? 我看过这篇文章,这是一个例子: http : //containerdiv.wordpress.com/2009/05/01/safely-using-production-assets-in-staging/ 这是rails +独angular兽+ nginx + S3。