Browsed by
Category: Web server

Fixing a 60 SSL certificate : unable to get local issuer certificate error

Fixing a 60 SSL certificate : unable to get local issuer certificate error

For a while I’m using the Tiny Tiny RSS server. Lately I updated it to the latest version and since then I got the ‘60 SSL certificate : unable to get local issuer certificate‘ error for some of the feeds.

After some research I found the solution by adding these lines to the php.ini:

curl.cainfo=”[path-on-the-webserver]\cacert.pem.txt”
openssl.cainfo=”[path-on-the-webserver]\cacert.pem.txt”

The cacert.pem file can be downloaded from https://curl.haxx.se/docs/caextract.html.

Remark: As you can see I gave the certificate file the .txt extension. If you just use the .pem extension you will probably get an error like this:

cURL error 77: error setting certificate verify locations:
CAfile: /Applications/XAMPP/xamppfiles/cacert.pem
CApath: none

Apache service not starting on Window 10

Apache service not starting on Window 10

Having problems starting the Apache service on Windows 10? Probably port 80 is used by another process.

When you check which process is using port 80 (use Resource Monitor), it probably is the ‘System’ process (PID=4).

Resource Monitor

This means that a process by default installed and started by Windows is using port 80. Big chance that the ‘World Wide Web Publishing Service’ is running. Just stop it and set the Startup Type to ‘Manual’

e World Wide Web Publishing Service

Now try starting the Apache service again. If it is running, the Resource Monitor should now show that the ‘httpd.exe’ process is using port 80.

Resource Monitor

How to disable System service from listening to port 80

How to disable System service from listening to port 80

When you try to run Apache (or any other web server service), it can happen that Windows is not allowing to start it, because port 80 is already in use. To find out which process is using port 80, you can use the Resource Monitor (just run resmon.exe). Open the ‘Network’ tab and open the ‘Listening Ports’ section.

Resource Monitor

Another way to find out is to use ‘netstat -a -n -o | find “:80”‘.

How to solve the problem

If the process is just a ‘normal’ process, you just need to stop the associated service to free port 80. If it’s the System process (PID=4), that is using port 80, then we need to disable http.sys.

There are two ways to disable it:

  1. Go to device manager, select ‘View -> Show hidden devices’, go to ‘Non-plug and Play Driver -> HTTP’ and double click it to disable.
  2. Launch RegEdit, go to ‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP‘ and change to value of ‘start‘ to 4.
    After this you need to reboot your computer.

The following values are valid for the ‘start’ property:

0 Boot
1 System
2 Automatic
3 Manual
4 Disabled

 

Apache: create a custom error page

Apache: create a custom error page

Error 404When you are using Apache as a web server and you want to create a custom error page, you can do it by defining an ErrorDocument in your config file (httpd.conf) as follows:

[code]

ErrorDocument 404 /errors/404.html

[/code]

This will show the page ‘404.html’ when the user accesses an unknown page. The path needs to be relative, because using a absolute path will probably give a 302 error. Because a relative path will always refer to the current website and thus this will only work for this site.

But if you are hosting more sites (using virtual hosts) and want to use the same error page for all the sites, you can create an alias for ‘/errors/’, so for all site this directory will exist.

You create the alias as follows:

[code]Alias /errors/ d:/wwwroot/errors/[/code]

In this example the ‘/errors/’ directory will point the the absolute path ‘d:/wwwroot/errors/’ on your web server.

This is not all, because we didn’t set any permission for the absolute directory. Without doing this, the error page cannot be accessed. Use the following configuration to set permissions for the directory.

[code]

<Directory d:/wwwroot/errors/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
Satisfy Any
</Directory>[/code]

Now your web server will show your custom error page. In this example a 404 error page was configured, but for other error codes the configuration is the same.

Tip: Sending a 404 error by code
If your site has directories where files needed by your site are stored, but should not be viewable by anybody (if browsing is allowed by the web server), you can always put an index document in the directory which will show an empty page or something like that.

An alternative would be to redirect the user to the 404 error page we just configured. If your web server is running PHP, then putting the following code in ‘index.php’, will do the trick:

[code]</pre>
<?php
header( "HTTP/1.1 404 Not Found" );
header("Location: /errors/404.html");
?>
<pre>[/code]

How to fix Apache error ‘AH00326: Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting’

How to fix Apache error ‘AH00326: Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting’

apache_logoIf your Apache web server error.log shows the ‘Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting’, you should check the following:

  • Check if the line with ‘Include conf/extra/httpd-mpm.conf‘ is active in ‘httpd.conf’
  • Check your ‘httpd-mpm.conf‘ if the ThreadsPerChild options has a value needed for your situation (default = 150)

More information about the ThreadsPerChild options can be found here.