Hot answers tagged

33

As suggested, I asked the question on ServerFault: http://serverfault.com/questions/161768/restart-webserver-without-entering-a-password But the short answer is: Backup your key: > cp server.key server.key.org Strip out the password: > openssl rsa -in server.key.org -out server.key [enter the passphrase] The newly created server.key file has ...


8

Great question! This can actually be done, but it's relatively tricky. Tumblr has made it very clear that they don't want you to do this. They have silently broken CloudFlare integration a while back, where everyone who did this reverse proxy stuff with CloudFlare has basically gotten booted off of their custom domain name without any warning. (Keep in ...


7

You need to drop the 'http:' prefix from all image (and any other) links on your site. When you do so, your browser will default to whatever protocol the page loads with. For example this is best: <a href="//www.example.com/"> And this is not: <a href="http://www.example.com/"> The top example is perfectly valid markup and you will load all ...


6

Yes. One of the web servers used to have a large spike in load every few hours. After looking into the logs, I found out when the load spike happened, there where a lot of people looking at the gallery. So I off-loaded 99% of the static content from apache to nginx. apache was left to serve all of the php. The load on my web servers dropped to a nice low ...


6

Nginx uses the try_files directive to 'see if something exists and fallback to another option' instead of using if statements and rewrites. Within your server block, create a location block that will match your files (e.g. files ending in jpg, gif, png - add whatever extensions you want). Within that block, you will add your try_files directive. Nginx will ...


6

In your robots.txt add #Baiduspider User-agent: Baiduspider Disallow: / #Yandex User-agent: Yandex Disallow: /


6

See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3: The max-age directive on a response implies that the response is cacheable (i.e., "public") unless some other, more restrictive cache directive is also present. It's conceivable (likely?) that there are proxies in the wild which break this but since the only failure mode could be ...


5

The 301 redirect that you are doing is the correct way to recover. The canonical tag that you are considering and 301 redirects can't be used at the same time. The canonical tag is only for pages that can't be redirected. Recovery should be in a week to a month. If it is longer than that, it is likely that something else has happened.


5

Someone was Fuzzing your server. Also see Wikipedia. Basically involves sending rapid blocks of invalid data to see if anything breaks. Nginx is set to return a 400 error error when no request data is sent. Don't worry about it. Nginx can just keep on bouncing them forever without breaking a sweat.


5

It's a regexp metacharacter that matches the beginning of a string. Since all strings have a beginning, this regexp matches any string. This is a typical nginx idiom for "redirect any URL to http://example.com/". The $ metacharacter matching the end of a string would work as well, but ^ seems to be what everybody uses.


5

Turns out, the WordPress install was indeed compromised. I did a diff of my existing install vs a new WordPress install, and diff reported new file: # diff -qr wordpress_installed/ wordpress_new/ Only in wordpress_installed/wp-includes: class-wp-init.php I also found wp-config.php had been edited to include this @include_once(ABSPATH . ...


4

Add this block to your NGINX config: server { listen 80; server_name here.your.ip.address; rewrite ^ http://example.com$request_uri? permanent; }


4

The main reason is: HTTP requests include the domain name. You could have stackoverflow.com and askubuntu.com all served off the same front end machine. When the server gets a request it needs to know what content it has to send. That's the main reason server configuration speaks about host name at all. Why do you have to set it if you're only serving one ...


4

Those are the backend servers that will handle the incoming request. So your domain's DNS should point to this nginx server, which will then use your upstream configuration to pass the request to one of the specified servers. Your config should look something like this (inside http {} block)... upstream backend { server backend1.example.com; server ...


3

No, php-fpm user does NOT need execute permissions on PHP files. It only needs read permission, as PHP files are parsed by PHP preprocessor and not executed directly.


3

Yes, you can run vBulletin with nginx. The rewrite rules you need will be specific to your setup and any modules you are using (you do not need any rewrite rules to run a standard vBulletin installation unless you use SEO Friendly URLs - see this vBulletin forum post). Many popular mods have already had their rules translated, (e.g. vbSEO) however, you can ...


3

You need to set an alias. location /coolapp/ { alias /var/www/apps/coolapp/; } Read more nginx Update after comment: Unfortunately, it's not working for me. I'm getting a 404 response when trying to request www.mysite.com/coolapp/test.php when /var/www/apps/coolapp/test.php exists To understand why alias is not working, you have to take a ...


3

I'd recommend not just looking at the type of web-server, but instead primarily focusing on the kind of website that you're running. Keep in mind that a Sitemap file is basically just a list of the valid URLs on your website. There are many ways that you could come up with a list like that (and with the associated meta-data, if you wish to provide it). In ...


3

Tuning a vserver takes a lot of time. Most of the time, you are playing the try & error game. And sometimes, the results are not very satisfying... But: To tune mysql, run the tuning-primer against the mysql instance you are trying to optimize: http://www.day32.com/MySQL/tuning-primer.sh This script tells you which parameters should be changed. If I ...


3

Wordpress MU might be overkill for just three blogs, but it will let you run everything against just one database and just one Wordpress install.


3

Apache can be a bit heavy, and can fall over when under heavy load. There are lighter weight servers available, including nginx, lighttpd, and cherokee. These lightweight options can be set up to serve static files quickly, and delegate dynamic server-side work to Apache.


3

Try to make one setting default and other one turned on by condition: expires max; valid_referers none blocked something.com; if ($invalid_referer) { rewrite ^ /leech.jpg; expires epoch; }


3

To direct the URL domain.tld/image/filename to the local path /imageshare/images/extension/filename, use the alias directive (see this for details): location /image/ { alias /path/to/imageshare/images/extension/; } If you really do mean to rewrite the URL to another URL, use: location /image/ { rewrite ^/image(.*)$ /imageshare/images/extension$1 ...


3

User agent wget Blocking the user agent wget will block operating systems that use wget to download files within the terminal i.e Linux, MacOS, Arm etc. This will block every file from being downloaded using wget example.pdf. But why block wget? There's no right or wrong to this question but generally webmasters want site visitors actually visiting their ...


3

Your first log snippet suggests that the file may actually exist, since nginx response is 200, with 731 bytes of payload data, so, don't be too fast to have it blocked. However, if you want to have such requests omitted from logs, you can use the following in all servers affected: location = /wpad.dat { access_log off; log_not_found off; } Or, ...


3

The HTTP status code 301 is named "Moved Permanently": The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. So the resource (i.e., your document) would stay the same, it just gets a new URI. As your front page http://example.com/ is (usually) not the same resource ...


3

The space is a delimiter (ie. a special character) in .htaccess so must be backslash escaped if you want to match a literal space in the regex. Eg. DV\ CRAWLER. (Otherwise you are likely to get a less than helpful 500 Internal Server error.) Or, you can use the shorthand character class \s which matches any white space character (space, tab or new line / ...


2

I would think this would be the expected behaviour would be this instead: www.example.com -> example.com www.example.com/test.html -> example.com/test.html That's a good idea. Just map the last parts of the URL (particularly folder and file) from the old domain to the new domain. You can easily use mod-rewrite if you have apache. Just make an ...


2

You didn't write ; at the end of the line. :) I've done the same mistake - and got the same alert.


2

A 404 response is the appropriate error message, you could even use 410 gone if you wanted. It's best not to use any redirect as it sounds like you don't want ExampleA.com associated with ExampleB.com, time should resolve this issue. If your in a hurry and have plently of time on your hands then you can manually remove the urls from Google webmaster tools ...



Only top voted, non community-wiki answers of a minimum length are eligible