Questions
Find answers to frequently asked development questions. For information about Better Stack products, explore our docs.
How do I redirect subdomains to a different port on the same server?
In Apache, you can redirect requests from subdomains to a different port on the same server using VirtualHost configurations and mod_proxy. This allows you to redirect traffic from a subdomain to a...
How do ServerName and ServerAlias work in Apache?
In Apache, ServerName and ServerAlias directives are used in the server configuration to define how the server should respond to different hostnames or domain names. These directives are essential ...
How do I select which Apache MPM to use?
Selecting the appropriate Apache Multi-Processing Module (MPM) depends on various factors, such as the server environment, expected traffic, and the type of workload the server will handle. Here ar...
How to handle relative URLs correctly with a reverse proxy in Apache
When using a reverse proxy in Apache, handling relative URLs correctly is crucial to ensure that requests are routed properly and content is displayed as intended. Here are steps to handle relative...
What does apache (busy workers, idle workers) mean?
In the context of an Apache HTTP server, the terms "busy workers" and "idle workers" pertain to the status of worker threads or processes handling incoming web requests. Busy Workers: These are the...
What's the best way of handling permissions for Apache 2's user www-data in /var/www?
Setting permissions for the Apache user (www-data in most cases) within the /var/www directory is crucial for security and proper functioning of web applications. Here are the recommended steps: 1....
Excessive number of sleeping processes in CentOS - how to diagnose?
An excessive number of sleeping processes in CentOS could be an indication of various issues or simply a normal state depending on the context. These sleeping processes, often represented by the st...
Why not use a WAMP stack?
A WAMP stack (Windows, Apache, MySQL, PHP) or its counterpart LAMP (Linux, Apache, MySQL, PHP) are software bundles that facilitate the setup and management of a web development environment. WAMP i...
What permissions should my website files/folders have on a Linux webserver?
On a Linux web server, setting the correct permissions for website files and folders is crucial for security and functionality. Here are general recommendations for permissions on website files and...
How can I disable TLS 1.0 and 1.1 in apache?
To disable TLS 1.0 and 1.1 in Apache, you need to modify the SSL/TLS configuration settings. This typically involves editing the Apache configuration file, such as ssl.conf or httpd.conf. Make sure...
SSL Certificate Location on UNIX/Linux
In UNIX/Linux systems, SSL certificate files are often stored in specific directories. The exact location can vary based on the distribution and configuration. Commonly, SSL certificates on UNIX/Li...
How to display a remote SSL certificate details using CLI tools?
You can use various command-line tools to display details of a remote SSL certificate. One common tool is openssl, which provides commands to fetch and examine SSL certificates. Here's an example o...
Must CSRs be generated on the server that will host the SSL certificate?
CSRs (Certificate Signing Requests) are generated for SSL certificates and are used by Certificate Authorities (CAs) to create the SSL certificate. They contain information about the entity request...
Best location to keep SSL certificates and private keys on Ubuntu servers?
On Ubuntu servers, the best practice for storing SSL certificates and private keys is to place them in a directory with restricted access. The standard directory for these files is typically within...
Nginx as Reverse Proxy With Upstream SSL
When using Nginx as a reverse proxy with SSL for upstream servers, it's a common scenario to secure the communication between Nginx and the upstream servers while also handling SSL termination at t...
Remove "www" and redirect to "https" with nginx
To remove the "www" from URLs and redirect all incoming traffic to HTTPS in Nginx, you can use a server block that handles both scenarios. Here's an example configuration: Open your Nginx configura...
How to force or redirect to SSL in nginx?
To force or redirect all incoming traffic to SSL (HTTPS) in Nginx, you can use a server block that handles HTTP requests on port 80 and redirect them to HTTPS. Here's an example configuration: Open...
Multiple domains with SSL on same IP?
Yes, you can host multiple domains with SSL on the same IP address using Server Name Indication (SNI). SNI is an extension of the TLS protocol that allows a server to present multiple SSL certifica...
Generating a self-signed cert with openssl that works in Chrome 58
To create a self-signed certificate that works with Chrome 58 using OpenSSL, you can follow these steps: Generate a private key: Use the following command to generate a private key. This example us...
Multiple SSL domains on the same IP address and same port?
It's possible to host multiple SSL (Secure Socket Layer) domains on the same IP address and port using Server Name Indication (SNI). SNI is an extension to the Transport Layer Security (TLS) protoc...
How to use MDC with thread pools in Java?
In Java, MDC (Mapped Diagnostic Context) is a feature provided by logging frameworks like Log4j and Logback. It allows you to associate key-value pairs with the current thread's execution context, ...
Configuring Log4j Loggers Programmatically
In Log4j, you can configure loggers programmatically using Java code. This allows you to define the logging configuration dynamically at runtime. To configure Log4j loggers programmatically, follow...
How to redirect Docker logs to file?
To redirect Docker container logs to a file, you can use the --log-driver and --log-opt options when running the container. Docker provides several logging drivers, and you can choose one that suit...
How to Customize the time format for Python logging?
To customize the time format for Python logging, you need to modify the formatter used by the logging module. Python's logging module provides a powerful mechanism to control the log message format...
Why you should not use java.util.logging
java.util.logging (JUL) is one of the built-in logging frameworks available in Java. While it's not inherently "bad," there are some reasons why developers may prefer using other logging libraries ...
How to disable Request logs in Python?
To disable request logs in Python, you need to configure your web server or web application framework to suppress logging of HTTP request information. The specific method to disable request logs ca...
How to log all or slow MongoDB queries?
To log all or slow MongoDB queries, you can use MongoDB's built-in logging capabilities and monitoring tools. MongoDB provides various options for capturing query performance and activity. Here's h...
How to log all or slow Redis queries?
Redis does not natively support query logging in the same way that some relational databases like MySQL do. However, you can still gather information about slow Redis commands or monitor Redis acti...
How to log all or slow MySQL queries?
To log all or slow MySQL queries, you'll need to modify the MySQL configuration file and enable query logging. The exact steps may vary depending on your MySQL version and the operating system you'...
How to log all or slow PostgreSQL queries?
To log all or slow queries in PostgreSQL, you can configure the PostgreSQL server's logging options. PostgreSQL provides various settings that allow you to control the level of detail for query log...
How to View PostgreSQL logs?
Viewing PostgreSQL logs can help you monitor and troubleshoot your database server. The steps to view the logs may vary depending on your operating system and PostgreSQL installation method. Here a...
What are Syslog formats?
Syslog is a standard protocol for logging and sending messages between network devices, including servers, routers, switches, and other networking equipment. Syslog messages typically contain infor...
How to disable logging when running tests in Python
To disable logging when running tests in Python, you can temporarily adjust the log level or remove the log handlers used during the test execution. This will prevent logs from being displayed or s...
How to log uncaught exceptions in C#
In C#, you can log uncaught exceptions using the AppDomain.UnhandledException event and a logging framework like log4net or NLog. The AppDomain.UnhandledException event allows you to handle uncaugh...
How to log uncaught exceptions in Java
In Java, uncaught exceptions can be logged using a combination of the Thread.UncaughtExceptionHandler interface and the setDefaultUncaughtExceptionHandler method. This allows you to define a global...
How to color logging output in Go
In Go, you can colorize logging output by using third-party libraries that support colored logging. One popular library for this purpose is "logrus," which provides a flexible logging framework wit...
How to log to file and console simultaneously in Python
To log to both a file and the console simultaneously in Python, you need to set up two handlers for the logger: one for writing logs to a file and another for printing logs to the console. The logg...
How to log a Python error with debug information (stack trace)
To log a Python error with debug information, including the stack trace, you can use the logging module. The logging module provides a flexible way to record messages from your Python code, includi...
How to log to file and console in Ruby
To log to both a file and the console (standard output) in Ruby, you can create two logger instances: one for the file and another for the console. Both loggers will be configured to log messages a...
How to log rotate in Ruby
In Ruby, you can implement log rotation by using a combination of the Logger class and external tools or libraries. Log rotation involves managing log files to prevent them from becoming too large ...
How to format log message in Ruby
In Ruby, you can format log messages using the built-in Logger class. The Logger class provides various options for customizing the log message format. You can include timestamps, log levels, and o...
How to change log level in Ruby
In Ruby, the logging level determines which log messages get recorded based on their severity. Ruby's built-in Logger class provides a simple way to handle logging and allows you to change the log ...
How to setup a cron job in Windows?
To set up a Cron job in Windows, you can use the Task Scheduler utility. Here are the steps to create and schedule a Cron job using Task Scheduler: 🔠Want to get alerted when your Cron doesn’t run ...
How to run Cron jobs in Go?
To run Cron jobs in Go, you can use a Go package called robfig/cron. Here are the steps to create and schedule a Go program using robfig/cron: 🔠Want to get alerted when your Cron doesn’t run corre...
How to run Cron jobs in Node.js?
To run Cron jobs in Node.js, you can use a Node.js package called node-cron. Here are the steps to create and schedule a Node.js script using node-cron: Install node-cron You can install node-cron ...
How to run Cron jobs in Python?
To run Cron jobs in Python, you can create a Python script with the code you want to run and schedule it to run using Cron. Here are the steps to create and schedule a Python script: 🔠Want to get ...
How to run Cron jobs in Java?
To run Cron jobs in Java, you can use the Quartz Scheduler library. Here are the steps to create and schedule a Java program using Quartz Scheduler: 🔠Want to get alerted when your Cron doesn’t run...
How to run Cron jobs in PHP?
To run Cron jobs in PHP, you can create a PHP script with the code you want to run and schedule it to run using Cron. Here are the steps to create and schedule a PHP script: 🔠Want to get alerted w...
How to run Cron jobs in Rails?
To run Cron jobs in a Rails application, you can use a gem called whenever. This gem allows you to define your Cron jobs in Ruby syntax and generates a crontab file for you. Here are the steps to u...
How to fix cron jobs that don't run?
If your Cron Jobs are not running, there could be several reasons why they are failing. Here are some common issues and solutions that you can try: 🔠Want to get alerted when your Cron doesn’t run ...
Thank you to everyone who
Here is to all the fantastic people that are contributing and sharing their amazing projects: Thank you!