In case you need to make Postfix look in your local /etc/hosts
files before doing DNS lookup add following in main.cf
file: Continue reading
Jan 11 2023
Postfix lookup in hosts file
Jan 10 2023
How to handle React routes in Apache and Nginx
Usually little setup of Apache and Nginx is needed so they can handle React routes properly without trying to treat them as real files or directories resulting in 404 Not Found in React.
Here are the snippets of the React routes related settings for Apache and Nginx. Continue reading
Dec 23 2022
Implement Secure Headers in Apache and Nginx
HTTP security headers are very important part of website security as it protect you against different types of attacks including, XSS, SQL injection, clickjacking, etc.
When you visit any website from your web browser, your browser requests it from the web server where the web site is hosted on. The web server then responds with HTTP Response Headers. These headers contains meta data, status error codes, cache rules and more. It also tell your browser how to behave when handling your website’s content. When you use the web and interacts with websites, your browser stores its information. These headers will help you to outline communication and improve web security. There are six most important security headers that you should be aware of and we recommend implementing if possible.
Be careful, these headers are applying globaly in server if you want to change to specific files please add headers inside a location (nginx) or filesMatch (apache) block. So if you add headers inside any location, files will apply only headers inside location block and global headers will not works for these types of files. Continue reading
Dec 23 2022
Implementing Cache control headers in Nginx and Apache
Cache-Control are HTTP cache headers that holds instructions for caching for requests and responses. It is used to defines how a resource is cached, where it’s cached and its maximum age before expiring. When you visit a website, your browser will save images and website data in a store called the cache. When you revisit the same website again, cache-control sets the rules that determine whether your resources loaded from your local cache or if the browser should send a request to the server for fresh resources.
For better understanding of how the browser renders pages quickly using the cache, you need to know about browser caching and HTTP headers. Continue reading
Nov 08 2022
.htaccess: Option FollowSymLinks not allowed here
I moved from mod_php to fcgi style hosting and got the following in Apache error log when I tried to open one of my websites:
[Tue Nov 08 08:34:08.357359 2022] [core:alert] [pid 19149] [client 95.158.43.63:14405] /home/domain.com/public_html/.htaccess: Option All not allowed here
[Tue Nov 08 08:35:58.058962 2022] [core:alert] [pid 14190] [client 95.158.43.63:46366] /home/domain.com/public_html/.htaccess: Option FollowSymlinks not allowed here
Oct 28 2022
Git Error cloning remote repo code 128 early eof
In case you cannot clone your repository even in shallow mode it means that more memory is needed for git to fetch the files. The git output is similar to:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
ERROR: Timeout after 10 minutes ERROR: Error cloning remote repo 'origin' git fetch --tags --progress --depth=1 -- git@bitbucket.org:username/repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: remote: Enumerating objects: 13045, done. remote: Counting objects: 0% (1/13045) remote: Counting objects: 1% (131/13045) ... Receiving objects: 98% (12804/13045), 360.22 MiB | 635.00 KiB/s Receiving objects: 98% (12804/13045), 360.95 MiB | 643.00 KiB/s fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed |
Again we see the same
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed Continue reading
Aug 31 2022
mysqldump directly to another server, mysqldump redirect to scp
It’s not a big deal to perform mysqldump command, get your database as a file and transfer MySQL database to another server by moving the file to another server and import it,
But what if there is no enough space on a disk to store the dump file? In this case it would be great to create MySQL dump file directly on the remote server. And not only you can create dump file directly but even clone a database to remote MySQL! Here I show how to do this.
Aug 26 2022
key type ssh-rsa not in pubkey accepted algorithms
I was running Ubuntu 20.04 happily, and then over the weekend decided to back everything up and install 22.04. I installed my previous keys but I couldn’t login via MobaXTerm remotely as I usually did with 20.04.
I logged in with a console and checked /var/log/auth.log
. Here are the messages generated upon my tries to log in:
1 2 3 |
userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth] Aug 26 06:37:05 ip-172-31-27-21 sshd[1750502]: error: Received disconnect from 209.158.53.89 port 9085:14: No supported authentication methods available [preauth] Aug 26 06:37:05 ip-172-31-27-21 sshd[1750502]: Disconnected from authenticating user ubuntu 209.158.53.89 port 9085 [preauth] |
Aug 12 2022
Jenkins: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
Again the same git error: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed.
This time – during the execution of Jenkins pipeline:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
ssh_dispatch_run_fatal: Connection to 104.10.141.1 port 22: message authentication code incorrect fatal: the remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed warning: unable to unlink '(NULL)': Invalid argument at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2681) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2102) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:86) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:624) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:853) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:160) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:375) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:73) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:118) at java.lang.Thread.run(Unknown Source) Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 192.168.2.90/192.168.2.90:477 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356) at hudson.remoting.Channel.call(Channel.java:1000) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145) at jdk.internal.reflect.GeneratedMethodAccessor1213.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131) at com.sun.proxy.$Proxy76.execute(Unknown Source) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1224) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1302) at hudson.scm.SCM.checkout(SCM.java:540) at hudson.model.AbstractProject.checkout(AbstractProject.java:1217) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:647) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:519) at hudson.model.Run.execute(Run.java:1897) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:442) ERROR: Error cloning remote repo 'origin' Finished: FAILURE |
Jul 29 2022
Using GotoIfTime with Timezones in Asterisk
Starting from Asterisk 1.6 GotoIfTime application supports Timezone parameter:
[Syntax]
GotoIfTime(times,weekdays,mdays,months[,timezone]?[labeliftrue][:labeliffalse])
I setup a system that receives calls from people in different timezones so I need to use Timezone parameter in GotoIfTime Asterisk application. Surprisingly I could not find examples on Asterisk’s website so I had to search for some.
There can be two possible formats: you can specify timezone as a shift relative to the time the Asterisk operates in, or you can specify as a path to respective timezone file. Here are the examples: Continue reading