我有一个网站example.com工作文件在/ var / www / html和一个router.php处理path和文件路由(以一种效率不高的方式,但一切工作正常)。 我试图使用Slim框架在/ var / www / html / api / v1的子目录中创buildapi,该子目录具有我的index.php应用程序文件和其他api相关文件。 API在本地主机工作正常,但是我努力configuration网站+ API与Nginx一起。 常规网页工作正常 example.com/page1 => var/www/html/router.php example.com/page2 => var/www/html/router.php 但是,当我尝试达到我的api(Slim index.php应用程序),它返回404。 example.com/api/v1/users => var/www/html/api/v1/index.php example.com/api/v1/products => var/www/html/api/v1/index.php 这是我的网站可用的configuration: server { listen 80; server_name example.com; root /var/www/html; index index.php index.html; location / { #try_files $uri $uri/ /router.php?$query_string; rewrite ^/([a-zA-Z0-9_-]+)$ /router.php?pid=$1; […]
我的configuration: location /route/ { root /usr/share/nginx/html; location ~ \.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } location / { try_files $uri $uri/ /index.php?$args; rewrite ^/(\w+)$ /?system=$1 break; rewrite ^/(\w+)/(\w+)(/.)*$ /?system=$1&id=$2 break; rewrite ^/(.*)/$ /$1 permanent; location ~ \.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; […]
我在nginx中使用图像filter模块来调整图像大小,并随时更改图像质量。 但质量不会改变,直到我调整图像的大小。 为什么会发生这种情况,如何解决这个问题? image_filter_jpeg_quality 40; image_filter resize 1200-; image_filter_buffer 8M; image_filter_interlace on;
我正在用NGINX设置一个服务器集群作为负载均衡器。 所有请求都通过HTTPS进行,因此负载均衡器使用直接将请求传递到具有stream(SSL传递)的群集。 我需要terminal服务器来查看客户端IP而不是负载均衡器IP。 我的nginx.conf ## Misc other config stuff stream { map $ssl_preread_server_name $backend_cluster_map { site.a cluster_1; site.b cluster_2; default cluster_1; } upstream cluster_1 { server 10.0.0.202:443; server 10.0.0.203:443; } upstream cluster_2 { server 10.0.0.204:443; server 10.0.0.205:443; } server { listen 443; proxy_pass $backend_cluster_map; ssl_preread on; } } 我试图改变服务器块,以包括proxy_set_header转发IP,但没有通过nginxtesting,说明proxy_set_header directive is not allowed here 。 […]
我有一台运行在HyperV主机上的Ubuntu 16.04服务器。 那里有几个网站 – 有些使用SSL,有些则不是。 所以我添加了一个额外的网卡给HyperV,并在/ etc / network / interfaces中添加了一个额外的接口 所以我有10.0.6.16作为主界面 – 这也承载了SSL网站和10.0.6.17的非SSL网站托pipe的额外接口。 在边缘防火墙级别,每个接口都被分配到不同的外部IP地址 这一直工作好几个月 – 现在我今天下午重新启动Ubuntu服务器(没有更新安装afaik),现在10.0.6.17已停止响应,非SSL网站全部closures。 输出ls / sys / class / net enp0s10f0 eth0 lo 输出ifconfig: enp0s10f0 Link encap:Ethernet HWaddr 00:15:5d:b3:0b:11 inet addr:10.0.6.17 Bcast:10.0.6.255 Mask:255.255.255.0 inet6 addr: fe80::215:5dff:feb3:b11/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:126 errors:0 dropped:0 overruns:0 frame:0 TX […]
我们在aws ELB中使用nginx运行php7,并在AWS集群redis中处理会话,但是会话没有存储在AWS redis集群中。有时可以使用,但大部分时间不起作用。 在php.ini中已更改为session.save_handler = redis和session.save_path =“tcp:// redis configuration endpoint:6379” 请在此帮助。
我们用nc来听一个端口: nc -kluvw 0 localhost 9000 使用nc发送消息: echo "hi" | nc -u localhost 9000 这将在服务器上打印“Hi”。 但是,将访问日志设置为系统日志logging器时,不会logging任何内容。 logging到/ dev / stdout的作品。 作品: access_log /dev/stdout l2met; 不起作用: access_log syslog:server=localhost:9000 l2met;
这是情况。 我已经在运行Ajenti的ubuntu 14.04虚拟机上安装了prestashop 1.7.1,所以我的php-fpm和nginx。 看了很多教程和一些自定义configuration后,我设法让一切正常工作。 然而,我只是安装了一个新的模块,当调用的PHP文件,工作(生成XML)我服务的文件,而不是proccessed结果。我检查了文件的权限,我什至尝试所有文件777。 我已经注意到问题出在哪,yginx的configuration是: set $admin_dir /admin_folder; gzip on; gzip_vary on; gzip_proxied any; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Supposed to be the case but we never know # text/html; gzip_disable "MSIE […]
我试图重写到一个PHP文件在Nginx中没有改变的URL,但PHP-FPM没有处理文件,我得到的是一个500。 如果我删除重写并直接访问文件,它的工作原理,所以.php文件没有错。 server { listen 80; root /var/www/example.com/public_html; server_name example.com www.example.com; index index.html index.php; add_header Access-Control-Allow-Origin *; location ~ ^/InfoCenter/api/.*$ { rewrite "/InfoCenter/api/(.*)" /InfoCenter/api/index.php last; } location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php/php7.0-fpm.sock; include fastcgi_params; } location ~/\.htaccess { deny all; } }
给定一个nginxconfiguration: proxy_pass http://yahoo.com; 你如何获得访问日志中的string“ http://yahoo.com ”? $ remote_addr是ip。