Articles of nginx

NGINX反向代理Apache在端口8080上运行,拥有owncloud

我有nginx作为我的主要networking服务器运行。 我已经在端口8080上安装了运行apache的owncloud。我知道owncloud对nginx有非官方的社区支持,但我更愿意保留官方的支持。 我目前的问题是,反向代理似乎没有按预期工作。 它不断加载我的默认网站。 我的网站使用灵活的HTTPS SSL证书通过cloudflare运行。 但是,我可以去xxx.xxx.xxx.xxx:8080并直接访问owncloud。 主要的nginxconfiguration user www-data; worker_processes 2; worker_rlimit_nofile 20480; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 15; types_hash_max_size 2048; server_tokens off; # log_format main '$remote_addr – $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"'; log_format main […]

redirect到: /

我有一个应用程序运行在localhost:8080 ,我configurationNginix使其运行localhost/ 我有另一个应用程序运行在localhost:3000 我想要做的就是把我redirect到localhost:3000/[whatever]当我最初去localhost/[whatever] 类似的东西: location /[SOMETHING] { proxy_pass http://localhost:3000/[THAT_SAME_THING_ABOVE]; } 是否有可能configurationNginx做这个行为? 如果是的话如何? 谢谢

Apache在dynamic主机上重写为nginx

我做了一些阅读,我找不到我的问题的答案,因为它有一个关键组成部分是不同于大多数情况下。 它和其他故事一样:我需要将.htaccess迁移到nginxconfiguration中,如果不是这样,nginx服务器设置为使用dynamic主机: server { listen 80; server_name ~^(www\.)?(?<sname>.+?).server.company.com$; root /var/www/$sname/current/public; index index.html index.htm index.php; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~* \.(gif|png|bmp|ico|flv|swf|exe|html|htm|txt|css|js) { add_header Cache-Control public; add_header Cache-Control must-revalidate; expires 7d; } location ~ \.php$ { fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; include fastcgi_params; fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; } location ~ /\.ht […]

为什么nginx服务http2,还是它?

一直试图让我的nginx服务器上的http2,我对一些事情感到困惑。 我环顾了这里和networking周围,但是我没有find我正在寻找的东西,或者是在它还没有被“释放”时使用过时的信息来回答。 我有工作nginx服务器,使用虚拟主机。 它有http_v2模块 me@server:/etc/nginx$ sudo nginx -V | grep http2 nginx version: nginx/1.10.3 built with OpenSSL 1.1.0f 25 May 2017 TLS SNI support enabled configure arguments: –with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-2tpxfc/nginx-1.10.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' –with-ld-opt='-Wl,-z,relro -Wl,-z,now' –prefix=/usr/share/nginx –conf-path=/etc/nginx/nginx.conf –http-log-path=/var/log/nginx/access.log –error-log-path=/var/log/nginx/error.log –lock-path=/var/lock/nginx.lock –pid-path=/run/nginx.pid –modules-path=/usr/lib/nginx/modules –http-client-body-temp-path=/var/lib/nginx/body –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-proxy-temp-path=/var/lib/nginx/proxy –http-scgi-temp-path=/var/lib/nginx/scgi –http-uwsgi-temp-path=/var/lib/nginx/uwsgi –with-debug –with-pcre-jit –with-ipv6 –with-http_ssl_module –with-http_stub_status_module –with-http_realip_module […]

nginx:“server”指令在这里是不允许的

我与我的nginx服务器conf有问题。 当我运行nginx -t它说所有的东西都是正确的,但是当我检查每个文件的configuration文件时,它就是KO。 它说 : nginx:[emerg]“server”指令在/etc/nginx/sites-available/thebishop.fr.conf中是不允许的:1 这里有一些conf文件:nginx.conf user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; more_set_headers 'Server: 185.216.27.123'; client_max_body_size 20M; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; # server_names_hash_bucket_size 64; # server_name_in_redirect […]

Nginx http将httpsredirect到第一个server_name

我有一个这2个服务器块在我的nginx/sites-enabled/application.conf : upstream myapplication { server 127.0.0.1:8081; } server { listen 80; server_name app1.example.net app2.example.net app3.example.net; return 301 https://$server_name$request_uri; } server { listen 80; server_name app1.example.net app2.example.net app3.example.net; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_certificate /etc/ssl/certs/example_net.crt; ssl_certificate_key /etc/ssl/certs/example_net.key; ssl_verify_client off; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers RC4:HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; proxy_ssl_session_reuse off; location /apply { rewrite ^/apply(.*) $scheme://$server_name/?$query_string? permanent; […]

Nginx的http_cookie和cookie_name有什么区别?

我想在Nginx中添加一个远程ip作为一个Cookie,以便它可以传递到负载平衡器粘性的AWS负载平衡器。 location / { proxy_set_header Cookie "$http_cookie; ip=$remote_addr"; proxy_pass http://app_upstream; } 我正在使用这些设置cookie,但AWS ELB不接受这种粘性。 由于此服务器被用作iframe,所以我无法使用ELB生成的cookie进行负载平衡,以防Safari / IOS在默认情况下阻止第三方Cookie。 我打开nginx并写一个自定义的反向代理以及。

nginx位置别名导致错误

我得到一个错误的nginx与我尝试sudo service nginx reload与以下包括: location /supermarkets.* { alias /supermarkets } 我想要做的是,如果链接是例如111.111.11.11/supermarkets/something东西,它应该redirect到111.111.11.11/supermarkets 。 作为上下文,这是反应路由器,我想使用浏览器,而不是散列。 全部 server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # #listen 443 ssl default_server; #listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure […]

如何使用nginx反向代理设置postfix

我想制作一个邮件服务器。 但是,我想我的邮件服务器不直接连接到互联网。 所以我让另一台服务器可以通过互联网访问,并使用反向代理与Nginx。 但由于某些原因,反向代理无法连接到邮件服务器。 这是我的nginx conf: user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } stream { log_format proxy '$remote_addr [$time_local] ' '$protocol $status $bytes_sent $bytes_received ' '$session_time "$upstream_addr" ' '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; access_log /var/log/nginx/access.stream.log proxy; server { listen 25; #protocol smtp; proxy_pass 10.0.1.15:25; } server { listen 110; #protocol […]

我已经更新了CentOS 7,现在nginx不会在系统启动时自动启动

我已经通过命令“yum update”更新了我的服务器的操作系统(CentOS 7),现在NGINX在系统启动时不启动。 在启动日志显示: Sep 15 05:41:30 mgniers nm-dispatcher: req:1 'hostname': start running ordered scripts… Sep 15 05:41:30 mgniers NetworkManager[3277]: <info> [1505464890.7261] dhcp-init: Using DHCP client 'dhclient' Sep 15 05:41:30 mgniers NetworkManager[3277]: <info> [1505464890.7261] manager: rfkill: WiFi enabled by radio killswitch; enabled by state file Sep 15 05:41:30 mgniers NetworkManager[3277]: <info> [1505464890.7261] manager: rfkill: WWAN […]