New answers tagged

0

Remove listen domain.co.uk:80; Here's the start of one of my configs server_name www.example.com; listen 443 ssl http2; ssl_certificate /var/lib/acme/certs/***CERT_DIRECTORY/fullchain; ssl_certificate_key /var/lib/acme/certs/***CERT_DIRECTORY/privkey; # Set up preferred protocols and ciphers. TLS1.2 is required for HTTP/2 ssl_protocols TLSv1 TLSv1.1 ...


0

Add the entire 'main' snippet within the 'blocking' snippet and move it above the original 'main' snippet. Basically, you've got two totally different locations as far as nginx is concerned, so you get no PHP processing unless you ask for it in the 'blocking' snippet.


0

I was coding from memory of past programs and had forgotten some of the requirements, such as Status:. I haven't had a chance to double check how many newlines and returns are necessary, or even if I really need the HTML, but here is the changed line from my original question that finally worked. I will make edits later if I find some things that can or ...


0

Nginx has this ability, though it's behavior changed in v1.7.5. Prior to v1.7.5, you could only add headers to return codes less than 400. After v1.7.5, you can assign headers to any return code with the always argument. The syntax is as follows: add_header name value [always]; add_header X-Test headervalue always; - will attach the header to all ...


0

Try adding "always" to the add_header directive: If the always parameter is specified (1.7.5), the header field will be added regardless of the response code. See documentation for more details. For your example it would look like this: location /api/get-hloc { #add acccess-allow headers add_header 'Access-Control-Allow-Origin' '*' always; ...


0

If both your projects are in the same directory on the host, it's easy - just set the web root to the containing folder (/home/user/www).


0

A flexible solution would be to use upstream: upstream backend { server 127.0.0.1:1337 max_fails=1 fail_timeout=5s; } server { listen *:80; server_name live.domain.com; server_tokens off; charset utf-8; error_log /var/log/nginx/live-error.log info; access_log /var/log/nginx/live-access.log; ...


0

I think you should install openssl-devel(yum install openssl-devel). Then you could recompile PHP with latest OpenSSL.


1

DerfK is right about dynamic content at the full page level, you absolutely don't want cookie leakage to occur. However you can do more caching at the layers upstream - with WordPress specifically, it has a decent pluggable object cache. This means, that while the page itself won't be cached, you can store much of the database load within a ephemeral store ...


3

In general caching works poorly with dynamic content, especially with content that contains things like "recently viewed" that will change every singe page load. If you really want to use caching then the first step is to disable that plug in so that there's a theoretical chance that someone might be served the same page twice. The second step is to only ...


0

i would suggest you to use return 301 https://$server_name$request_uri; at the place of return 301 https://$host$request_uri; as $host will include all the server names and redirect everything to same host.


0

While Michael Hamptons answer is correct, it is only part of the answer. A more complete version would be: Check if the user exists Also check which user you use to start the docker container If you do: docker -u 0 .... then the same message will appear even if the user exists on the host system. Changing the value behind -u to the id of user nginx ...


0

I had the same problem, and solved the problem by change the directory mode to 755. This is what I referred: https://gist.github.com/jhjguxin/6208474


1

VPN server don't redirect web trafic by default, as explained here, adding the line push "redirect-gateway def1" on your openvpn.conf will permit you to have the VPN server IP as your remote IP, and with that your web server should let you pass.


0

I just ran into this very problem on Ubuntu 16.04 and I'm leaving my answer here for future users from Google who stumble onto the problem. Since chkconfig is mostly specific to CentOS, it obviously doesn't exist on Ubuntu. Apparently, to get a custom-built PHP (php-fpm SAPI) to start at boot under systemd, which is new to Ubuntu 16.04 (previously, Upstart)...


0

Make two server sections for 80 and 443 ports. And use 80 port on upstream server, you already make SSL connection on nginx, there in no need to use SSL connection between frontend and backend. Use something like this to forward all requests from http to https version of site. server { listen 80; server_name umarket.lt; rewrite ^(.*) https://$...


0

In /etc/fail2ban/jail.conf [nginx-x00] enabled = true port = http,https filter = nginx-x00 logpath = /var/log/nginx/access.log bantime = 3600 maxretry = 1 and in /etc/fail2ban/filter.d/nginx-x00.conf [Definition] failregex = ^<HOST> .* ".*\\x.*" .*$ and you're done. Next time someone mess with you, he/she will be banned for an hour or ...


1

This question is distinct from What Should be the Permissions of Apache SSL Directory, Certificate, and Key? because it is for nginx. However, following https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md helped me and the answer turned out to be the same as the answer to the apache question What Should be the Permissions of ...


1

You should never run munin-cron with 'root' user. Try running this command: chown -R munin:munin /var/www/munin After this try running "munin-cron" back from the "munin" user.


-1

@AAgg, Just reissue the certificate from your cert provider with new CSR and Key. I have done that several times without having any issues.


0

Talk to cert vendor Depending on your vendor, they may either insist on re-payment, or just do this free of charge. I would not spend time looking for the cert in nginx's RAM. Sure, if https still works, then the privkey must still be there, and extraction from RAM is possible, but if you have never done this before, then just buying another cert is the ...


0

Because you are serving PHP from two different roots, you will need two locations to serve PHP. At the moment, you have created a location to serve normal files only. Also, the use of alias is not required here, as the local path ends with the URI. It is much simpler to use root in this case. Using the ^~ modifier with a prefix location forces it to take ...


0

So if you want to recreate the /etc/nginx files, you should do: sudo apt-get install --reinstall nginx-common


0

Try this upstream puma { server unix:/home/chris/Rails/chrisbim2ree/shared/tmp/sockets/chrisbim2ree-puma.sock; } Here's one I have defined as an example upstream php-fpm { server unix:/var/run/php-fpm/php-fpm.sock; } I've never used @ in locations, but I had a quick read about it, nothing obvious seemed off. I'm not sure what you're trying to do ...


0

believe the quick and dirty one will be to use include https://www.nginx.com/resources/wiki/start/topics/examples/full/#nginx-conf https://kcode.de/wordpress/2033-nginx-configuration-with-includes


0

If you have: keepalive_timeout 65; I can imagine that it can take a while for connections to get terminated and workers restarted. I am not quite sure without looking in the code if nginx is waiting for them to expire once it gets a reload. You could try lowering the value and see if it helps.


1

Use second map map $http_app_code $app_code { default "server-api-1"; ~app1 "server-api-1"; ~app2 "server-api-10"; ~app3 "server-api-21"; } map $app_code $app_version { server-api-1 v1; server-api-10 v1; server-api-21 v3; } location /getSite { proxy_pass http://$app_code.dev.internal.com/api/$app_version/getSite; }


0

I've got it working: location /files { types { } default_type text/css; gzip on; gzip_min_length 1; gzip_proxied any; gzip_types text/css; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_comp_level 6; } And test: curl -v localhost/files/test1 * About to connect() to localhost port ...


0

Edited my nginx.conf and changed the user from nginx to deployer (my deployment user for capistrano and member of wheel group), and now everything works great!


-1

You can make a location for these files and set default_type for them... But why are you doing such a strange thing? It could be soemthing like this: server { server_name my_server.com; listen 80; location /my_files { types { } default_type text/css; } } Theoretically it should send all files under this location as "text/css" ...


1

For this, in the same configuration file you will have: server { listen 80; server_name www.help.example.com.br help.example.com.br; root /path-to-my-docs/docs_site/; client_max_body_size 4G; location / { } AND server { listen 80; server_name *.example.com.br; # Notice the wildcard. root /opt/apps/gsa-web/src/; client_max_body_size 4G; ...


0

Solved it by adding this configuration in /etc/nginx/conf.d/default.conf # # The default server # server { server_name drupaldocker.com; root /var/www/html; ## <-- Your only path reference. location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found ...


0

Yes, you can have nginx proxy requests to HTTP servers, and then itself respond to clients over HTTPS. When doing this, you will want to be sure that the nginx<->proxy connect is unlikely to be sniffed by whoever is your expected attacker. Safe-enough approaches might include: proxying to the same host (as you do) proxying to other hosts behind your ...


0

Ok here is what i did and the error went away edited the php.ini file nano /etc/php5/fpm/php.ini and made this change, basically changed from off to on ;short_open_tag = Off short_open_tag = On Instead of this will like to know how else to solve that error though Thanks UPDATE: this only worked for PHP 5.5.9 but did not work for PHP 7.0.4 So still ...


0

Your problem is apparently with the short open tag <? near the end of the get_recent_posts() function. Change it to <?php and that problem will go away. Next time you have programming errors, please refer to http://stackoverflow.com.


2

If you cannot find the files that it is loading in your web directory, there could be a problem of someone pointing your DNS to their server in order to hijack your traffic. I would start with verifying your DNS, and after that is made sure to point to the correct place, try running a new installation of wordpress with just a default page to see if it ...


1

It wouldn't, at least not how you've currently designed things. You'll need to not use name-based vhosts, and instead accept all host headers at the webserver level. Then deal with routing requests with certain host headers properly within your application.


1

The configuration looks like it is not valid for Drupal 8. According to https://pantheon.io/blog/update-your-nginx-config-drupal-8 article, Drupal 8 has some unusual paths that need to be covered separately in nginx configuration. The article should contain the information you need to fix the issues.


0

I think you used try_files wrong in the section location / { # try_files $uri @rewrite; # For Drupal &lt;= 6 try_files $uri /index.php?$query_string; # For Drupal &gt;= 7 } The last argument of try_files is the "404" location. Id you edit it to try_files $uri /index.php?$query_string =404; it might work


0

You have set up pm.max_children to 30, which means that there can be only 30 concurrent PHP scripts running at the same time. When more users visit your sites, there aren't any free PHP processes to serve the request. nginx waits for some time, before returning the 504 Gateway Time-out error. You seem to have plenty of free memory, as your cached column ...


2

Your problem will likely be SELinux. /usr/share/nginx/html; This is a non-standard place to put web related files (on CentOS), which would normally go in /var/www/html. As such the default policy will not allow httpd_t (nginx)to write to usr_t files and directories. You can move your files into /var/www/html... and run restorecon or you can add a new ...


1

It's a file permissions issue, probably in conjunction with the user/group your web server is running as. Read my guide to Wordpress which has a permissions section. Here's the core of what I do to set up permissions. I have it as a script I can run any time. Set one, setting up users and groups useradd tim (NB: you can name the user something else if ...


1

You are redirecting every request /blah/blah/whatever, to just plain /v2/ which is not what you wanted. location / { return 301 /v2$request_uri; } will preserve original requested URI prepending it with /v2/.


0

You can always change it and build Nginx, which is surprisingly easy. In src\https\ngx_http_header_filter_module.c Change ngx_string("200 OK"), to whatever you like. To build Nginx follow this guide I've written, or any other "how to build Nginx" guide. Here's the core of it, for reference cd /home/ec2-user mkdir nginx-build cd nginx-build service ...


1

Load balancer was forwarding request over HTTP and that was creating redirect loop. I've fixed it by adding a check for $http_x_forwarded_proto header around my redirect: if ($http_x_forwarded_proto != "https") { return 301 https://$host$request_uri; }


0

In the end I changed the encoding of the ssl file itself and then it started working. Note: I merged the ssl files together with the > command and that didn't work properly. Downloaded the individual keys to my computer, put them together in 1 file manually and then uploaded and it started working.


1

I searched Google for "Nginx as email proxy server" and found this article on the Nginx website on how to use Nginx as an email proxy server. Just change the port in the configuration. Perhaps you should try reading the official documentation then ask a question if it doesn't work for you.


-1

The IETF team is keeping track of client & server support here: https://github.com/http2/http2-spec/wiki/Implementations WKWebView is not marked as supported yet. It works fine on other mobile browsers though.


0

In Apache, as far selecting which IP address you want to use for the outgoing requests on the proxy you could use: https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxysourceaddress A fairly dirty way of doing this would be to have a bash script that changes the value of "ProxySourceAddress" in your Apache conf file to a different IP address every ...


-3

This works until you hit authenticated resources, which send back a 401 header to the client through the proxy which triggers a pop-up. https://answers.atlassian.com/questions/2515/answers/39133735?flashId=366096075



Top 50 recent answers are included