Hot answers tagged

27

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 ...


16

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 &...


13

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, ...


11

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

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

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

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

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

You really need to identify how the attacker got in. If it was through the webserver, it's actually relatively easy: Determine when the files disappeared. You've already put the files back, so we can't look at the directory's modification time. Instead, look to the webserver logs for 404 errors from those files. Determine what requests came into the ...


4

Presumably you just need to block HTTP access (return an HTTP status code of 403 - Forbidden) to these folders, if stored in the document root? In your document root .htaccess file: # Block HTTP access to certain folders RewriteRule ^classes/.* - [F] RewriteRule ^templates/.* - [F] (...and build flexibility into your framework to allow your framework to be ...


4

How do I capture the POST part of incoming HTTP requests for analysis? Try using ModSecurity - from its documentation on HTTP Traffic Logging: Web servers are typically well-equipped to log traffic in a form useful for marketing analyses, but fall short logging traffic to web applications. In particular, most are not capable of logging the request ...


4

Simple answer. Hosts provide what is asked for and works best. It is a double-sided coin. Apache has been extremely successful and is stable and seasoned code therefore hosts don't have to work hard to support it. As you may know, Apache is one of the first successful web servers and serves the vast majority of web installations therefore it is asked for the ...


4

After a little digging and playing around with this, I've managed to figure it out and now have a working scenario for mod_pagespeed to only work on specific domains (vhosts) on the same server. My configuration is based on a CentOs 6 build Apache 2 that runs Parallels Plesk Panel. Create a separate pagespeed conf file and store it in a location that won't ...


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