Hot answers tagged

26

First Step Open file as sudo vim /etc/apache2/apache2.conf Second Step remove comment sign (#) if you find it before this line ( line number 187 approx.) AccessFileName .htaccess Third Step Then find the line where there is <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory&...


26

I have some bad news for you. StartSSL's certificates are no longer trusted by Chrome, Firefox, and soon other browsers, beginning with newly issued certificates first. StartSSL won't tell you this of course and will happily sell you new certs, continuing their extremely shady pattern of behaviour. At this point all I can recommend is damage control by ...


14

People landing in this answer, please note that this is specific for Apache 2.2. Apache 2.4 has deprecated these directives. The new way is using the module mod_authz_host and the Require directives. (link) In Apache 2.4 you should do <Directory /var/www/ncp-web/> Require host localhost Require ip 127.0.0.1 Require ip 192.168 Require ip 10 &...


12

Easy. Just set something like this within your main configuration or your virtual configuration: <Directory /var/www/path/to/your/web/documents> Order Deny,Allow Deny from all Allow from 127.0.0.1 ::1 Allow from localhost Allow from 192.168 Allow from 10 Satisfy Any </Directory> The <Directory></Directory> statement ...


12

Sitemaps can be dynamic just like web pages. Just have a PHP script grab those names from the database and make a loop to echo out the XML for each one. Also, make sure you output the proper content type for your XML. That's it. The code below is a basic script for generating a dynamic XML sitemap. Please not this is only an example intended to point you, ...


8

Fix your hosts file at /etc/hosts. 1) From command line type hostname to get your hostname. Example output might be example.com 2) Edit /etc/hosts and change the lines to match your hostname. Example: ::1 localhost.example.com localhost 127.0.0.1 localhost.example.com localhost 192.168.1.104 example.com example 192.168.1.104 example.com. ...


8

Mod_alias and Mod_rewrite There are 2 modules you can use within the htaccess for controlling redirects these are known as mod_alias and mod_rewrite. To help you establish the difference between the two below is some commands to familiarize when you're using mod_alias or mod_rewrite. mod_alias commands Alias AliasMatch Redirect RedirectMatch ...


8

Here is the mod_speling documentation. The CheckCaseOnly directive does not enable the module on its own. You would need to both turn on mod_speling and also put in the check case only directive: CheckSpelling on CheckCaseOnly on When it is configured like this, mod_speling doesn't correct any spelling, it only corrects the case. This is a very awkward ...


8

It's correct to set this directive like RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS} If it doesn't work, you may need to install and enable the module mod_headers.


8

StartSSL confirmed that this is because of the partially revoked StartCom root certificate. They are working on getting their root certificate fully trusted by browsers again. It sounds like end of February would be the earliest time frame, so not in time to help my certs that expire in two weeks. :-( To: Stephen Ostermiller, This electronic mail ...


7

You're looking for a Geoloction (Geoblocking) database which would give you access to the typical IP ranges for the countries you need to block. This is not absolute or completely trustworthy information though. Country level geoblocking is mostly effective but anything like city/state/zip code level information should be treated with great caution. I've ...


7

Activate ModRewrite: sudo a2enmod rewrite sudo /etc/init.d/apache2 restart


7

You can use the Include directive to include other config files and split up your main config. # Virtual hosts Include conf/extra/httpd-vhosts.conf You can also use wildcards, so you can have each virtual host in a separate config file and include all without having to modify your main config file: Include conf/extra/vhosts/*.conf Reference: https://...


6

Regarding your second question: ::1 is localhost in ipv6. Regarding your third question: # Mark requests for the robots.txt file SetEnvIf Request_Method "^OPTIONS$" dontlog # Log what remains CustomLog logs/custom.log common env=!dontlog see also http://httpd.apache.org/docs/2.4/logs.html#accesslog


6

I think I see your problem. You are adding an extra question mark in your rewrite rule. RewriteRule ^(.*)$ index.php?/$1 [L] Should be RewriteRule ^(.*)$ index.php/$1 [L] based on the example urls your provide. http://laravel.lar/index.php/about/ doesn't have a question mark in it after index.php It is also possible that mod_rewrite is not enabled. ...


6

I met the same problem today. I solved it in two steps Enabling of rewrite module sudo a2enmod rewrite I changed AllowOverride None to AllowOverride All in my virtual host configuration file. AllowOverride None - prevents Apache server from reading of any .htaccess file located in your site directories. Hope it helps.


6

Digicert maintains pages for compatibility with certificate types: SAN certificate compatibility Wildcard certificate compatibility They note several server side compatibility problems with wildcard certificates but no client side problems. SAN certificates are problemic for some older browsers: Versions of major web browsers from before 2003. Older ...


6

The solution was located in digitalocean.com/community/articles/. I needed to perform the command: $ sudo a2ensite default-ssl


6

The problem is because you have some of the images hard-coded to load through http protocol on your index page. You should change the links to be protocol-agnostic by using //, e.g.: <img src="http://example.com/image.png"> Change with: <img src="//example.com/image.png"> These links will make content load through https if site is also using ...


6

Apache writes to the log file after the request has been completed. It is able to remember the time that the request was started and write this time into the log file after the request was finished. This means that Apache log files are not going to be strictly ordered. There may be earlier records that get recorded late because the requests takes a long ...


5

You're correct. RED implemented the requirements from HTTPbis http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-18#section-4.1. Normally, HTTPbis requirements are backwards-compatible with RFC2616 (i.e., they don't make implementations that were conformant to 2616 non-conformance now), but this change slipped through -- we'll be opening an issue ...


5

Add this section inside your virtual host directive: <Location /mypathurl> Order deny,allow Deny from all Allow from 192.168.1.10 </Location> Replace your IP above. This should not be used for financial level security, FYI.


5

After much research, I found this article on the Comcast forums: http://forums.comcast.com/t5/Home-Networking-Router-WiFi/SMCD3G-Can-t-access-web-server-from-LAN-from-Internet-OK/m-p/1754823#M55009 Essentially, certain models of Comcast routers (both home and business class) will experience an "issue" where requests made from inside the network "die" at the ...


5

I ended up setting the handler for SVG files to application/x-httpd-php, and used apache's mod_headers to pass the correct content-type header. <Files "*.svg"> SetHandler application/x-httpd-php Header set Content-Type "image/svg+xml" </Files> This was solved when I found a nearly identical question at https://serverfault.com/questions/...


5

One of the biggest changes from Apache 2.2 to 2.4 is the way that permissions for directories are granted. The allow from and deny from syntax is now deprecated in favor of the new require syntax. See Upgrading Apache from 2.2 to 2.4. There is a module mod_access_compat that is supposed to allow you to still use the old syntax. Unfortunately, it didn't ...


5

It generally makes little difference. A 301 redirect may cause a short term drop in ranking, but nothing to worry about. An internal rewrite keeps the same URLs. You just need to be careful that you don't end up with duplicate content on multiple URLs.


4

The point is to get the browser to cache resources your site uses wherever possible, as this reduces either HTTP requests or data transferred, both of which help speed. You do this either by setting Expires headers, which tell the browser to cache the resource until the specified time; or by using Last Modified / Etags, which give the browser a way to work ...


4

Best way is use some existing of Apache-GeoIP tools (or modules) mod-geoip (example for Debian) MaxMind GeoLite Country (usage - Getting Visitor's Country with PHP using Geo IP)


4

Try with the netmask instead of the CIDR notation: <Limit GET POST> order deny,allow allow from 37.18.184.0/255.255.252.0 ... allow from 37.77.172.0/255.255.252.0 deny from all </Limit> Alternatively do it like this: <Limit GET POST> order deny,allow allow from 37.18.184. allow from 37.18.185. allow from 37.18.186. allow from 37.18.187. ....


4

Probably the server doesn't recognize the script as executable, and that's why it offers it as a downloadable file. These lines should be present in your Apache config. Note that the path may need to be changed for the .so modules, depending on your configuration: *nix: # -- if you're using PHP 5, uncomment this line to activate it LoadModule php5_module ...


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