{"id":13326,"date":"2025-12-20T10:24:42","date_gmt":"2025-12-20T04:54:42","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?p=13326"},"modified":"2025-12-20T10:24:44","modified_gmt":"2025-12-20T04:54:44","slug":"how-to-setup-apache-on-linux-server","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/how-to-setup-apache-on-linux-server","title":{"rendered":"How to Setup Apache on Linux Server in 2026 &#8211; Step-by-step Guide"},"content":{"rendered":"\n<p><strong>To set up Apache on a Linux server<\/strong>, install the apache2\/httpd package, enable and start the service, allow ports 80\/443 in your firewall, create a Virtual Host for your domain, test the configuration for syntax errors, and enable HTTPS with Let\u2019s Encrypt. The steps vary slightly by distribution.<\/p>\n\n\n\n<p>In this beginner friendly guide on how to setup Apache on Linux server, you\u2019ll learn the exact steps to install, configure, secure, and optimize Apache (httpd) on popular distributions like Ubuntu\/Debian and CentOS\/RHEL\/AlmaLinux\/Rocky Linux. As a senior hosting professional, I\u2019ll also share real-world tips, security hardening, and performance tuning to run production-grade websites.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"what-youll-need-prerequisites\"><strong>What You\u2019ll Need (Prerequisites)<\/strong><\/h2>\n\n\n\n<p><strong>Before you begin, confirm the following:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Linux server (VPS, cloud, or dedicated) with Ubuntu\/Debian or CentOS\/RHEL-based distro<\/li>\n\n\n\n<li>Root or sudo access<\/li>\n\n\n\n<li>A registered domain (optional but recommended)<\/li>\n\n\n\n<li>Firewall access to open ports 80 (HTTP) and 443 (HTTPS)<\/li>\n\n\n\n<li>Package manager ready: apt for Ubuntu\/Debian, dnf\/yum for RHEL-based<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"apache-on-linux-naming-differences-that-matter\"><strong>Apache on Linux: Naming Differences That Matter<\/strong><\/h2>\n\n\n\n<p>Across distributions, Apache uses different package and service names:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu\/Debian: package <code>apache2<\/code>, service <code>apache2<\/code>, configs in <code>\/etc\/apache2\/<\/code><\/li>\n\n\n\n<li>RHEL\/CentOS\/AlmaLinux\/Rocky: package <code>httpd<\/code>, service <code>httpd<\/code>, configs in <code>\/etc\/httpd\/<\/code><\/li>\n<\/ul>\n\n\n\n<p>Keep these in mind whenever you run commands or <a href=\"https:\/\/www.youstable.com\/blog\/edit-wp-config-php-file-in-wordpress\/\">edit configuration files<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"step-by-step-install-apache\"><strong>Step-by-Step: Install Apache<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"ubuntu-debian\"><strong>Ubuntu\/Debian<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install -y apache2\nsudo systemctl enable --now apache2\nsudo ufw allow \"Apache Full\"    # enables 80 and 443\nsudo systemctl status apache2\ncurl -I http:\/\/&lt;your_server_ip&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"rhel-centos-almalinux-rocky\"><strong>RHEL\/CentOS\/AlmaLinux\/Rocky<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y httpd\nsudo systemctl enable --now httpd\nsudo firewall-cmd --permanent --add-service=http\nsudo firewall-cmd --permanent --add-service=https\nsudo firewall-cmd --reload\nsudo systemctl status httpd\ncurl -I http:\/\/&lt;your_server_ip&gt;<\/code><\/pre>\n\n\n\n<p>If you\u2019re on older CentOS with <code>yum<\/code>, replace <code>dnf<\/code> with <code>yum<\/code>. On minimal RHEL setups, ensure your network and DNS resolve correctly before proceeding.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"know-your-key-apache-files-and-directories\"><strong>Know Your Key Apache Files and Directories<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu\/Debian: <code>\/etc\/apache2\/apache2.conf<\/code>, <code>\/etc\/apache2\/ports.conf<\/code>, <code>\/etc\/apache2\/sites-available\/<\/code>, <code>\/etc\/apache2\/sites-enabled\/<\/code>, logs in <code>\/var\/log\/apache2\/<\/code><\/li>\n\n\n\n<li>RHEL-based: <code>\/etc\/httpd\/conf\/httpd.conf<\/code>, <code>\/etc\/httpd\/conf.d\/<\/code>, logs in <code>\/var\/log\/httpd\/<\/code><\/li>\n<\/ul>\n\n\n\n<p>Service management (works on both families):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status apache2|httpd\nsudo systemctl reload apache2|httpd\nsudo systemctl restart apache2|httpd<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"create-your-first-virtual-host-website\"><strong>Create Your First Virtual Host (Website)<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"1-prepare-the-document-root-and-permissions\"><strong>1) Prepare the document root and permissions<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/var\/www\/example.com\/public_html\necho \"&lt;h1&gt;Hello from Apache&lt;\/h1&gt;\" | sudo tee \/var\/www\/example.com\/public_html\/index.html\n\n# Ownership differs by distro:\n# Ubuntu\/Debian user is \"www-data\", RHEL-based user is \"apache\"\n# Ubuntu\/Debian:\nsudo chown -R www-data:www-data \/var\/www\/example.com\n# RHEL-based:\n# sudo chown -R apache:apache \/var\/www\/example.com<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"2-add-the-virtual-host-configuration\"><strong>2) Add the Virtual Host configuration<\/strong><\/h3>\n\n\n\n<p>Ubuntu\/Debian (sites-available + a2ensite):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/apache2\/sites-available\/example.com.conf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n  ServerName example.com\n  ServerAlias www.example.com\n  DocumentRoot \/var\/www\/example.com\/public_html\n\n  &lt;Directory \/var\/www\/example.com\/public_html&gt;\n    AllowOverride All\n    Require all granted\n    Options -Indexes\n  &lt;\/Directory&gt;\n\n  ErrorLog ${APACHE_LOG_DIR}\/example_error.log\n  CustomLog ${APACHE_LOG_DIR}\/example_access.log combined\n&lt;\/VirtualHost&gt;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2ensite example.com.conf\nsudo a2enmod rewrite\nsudo apache2ctl configtest\nsudo systemctl reload apache2<\/code><\/pre>\n\n\n\n<p>RHEL\/CentOS\/AlmaLinux\/Rocky (conf.d):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/httpd\/conf.d\/example.com.conf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n  ServerName example.com\n  ServerAlias www.example.com\n  DocumentRoot \/var\/www\/example.com\/public_html\n\n  &lt;Directory \/var\/www\/example.com\/public_html&gt;\n    AllowOverride All\n    Require all granted\n    Options -Indexes\n  &lt;\/Directory&gt;\n\n  ErrorLog \/var\/log\/httpd\/example_error.log\n  CustomLog \/var\/log\/httpd\/example_access.log combined\n&lt;\/VirtualHost&gt;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apachectl -t\nsudo systemctl reload httpd<\/code><\/pre>\n\n\n\n<p>If SELinux is enforcing and your document root is outside default paths, set proper contexts:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># RHEL-based SELinux example for a custom docroot:\nsudo semanage fcontext -a -t httpd_sys_content_t \"\/var\/www\/example.com(\/.*)?\"\nsudo restorecon -Rv \/var\/www\/example.com<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"enable-https-with-lets-encrypt-free-ssl\"><strong>Enable HTTPS with Let\u2019s Encrypt (Free SSL)<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"ubuntu-debian\"><strong>Ubuntu\/Debian<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y certbot python3-certbot-apache\nsudo certbot --apache -d example.com -d www.example.com\n# Test auto-renewal\nsudo certbot renew --dry-run<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"rhel-centos-almalinux-rocky\"><strong>RHEL\/CentOS\/AlmaLinux\/Rocky<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Enable EPEL if needed (RHEL\/CentOS):\nsudo dnf install -y epel-release\nsudo dnf install -y certbot python3-certbot-apache\nsudo certbot --apache -d example.com -d www.example.com\nsudo certbot renew --dry-run<\/code><\/pre>\n\n\n\n<p>Certbot adds SSL Virtual Hosts, installs the certificates, and configures HTTP-to-HTTPS redirection. Certificates renew automatically via systemd timers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"essential-security-hardening\"><strong>Essential Security Hardening<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"hide-server-details-and-disable-listing\"><strong>Hide server details and disable listing<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Ubuntu\/Debian: edit \/etc\/apache2\/conf-available\/security.conf (or apache2.conf)\n# RHEL-based: edit \/etc\/httpd\/conf.d\/security.conf (create if missing)\n\nServerTokens Prod\nServerSignature Off\n\n# In each &lt;Directory&gt; or global:\nOptions -Indexes<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"firewall-permissions-and-selinux\"><strong>Firewall, permissions, and SELinux<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Keep ports 80\/443 open only; block others unless needed.<\/li>\n\n\n\n<li>Use least-privilege permissions for web roots. Files: 644, directories: 755.<\/li>\n\n\n\n<li>On RHEL, for outbound connections (e.g., to app servers), allow: <code>sudo setsebool -P httpd_can_network_connect 1<\/code>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"security-modules-and-https-best-practices\"><strong>Security modules and HTTPS best practices<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Consider ModSecurity WAF: Ubuntu <code>sudo apt install libapache2-mod-security2<\/code>, RHEL <code>sudo dnf install mod_security<\/code>.<\/li>\n\n\n\n<li>Use strong TLS ciphers and enable HSTS when you\u2019re fully on HTTPS.<\/li>\n\n\n\n<li>Regularly patch: <code>sudo apt upgrade<\/code> or <code>sudo dnf upgrade<\/code>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"performance-tuning-for-real-traffic\"><strong>Performance Tuning for Real Traffic<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"select-the-right-mpm\"><strong>Select the right MPM<\/strong><\/h3>\n\n\n\n<p>For most modern sites, the <strong>event<\/strong> MPM scales better than <strong>prefork<\/strong>. If you run PHP, pair event MPM with PHP-FPM (not mod_php).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Ubuntu\/Debian:\nsudo a2dismod mpm_prefork\nsudo a2enmod mpm_event proxy_fcgi setenvif\nsudo a2enconf php*-fpm   # choose your installed PHP-FPM version\nsudo systemctl reload apache2\n\n# RHEL-based:\nsudo dnf install -y php-fpm\nsudo systemctl enable --now php-fpm\n# Example (in your vhost) to pass PHP via FPM socket:\n# &lt;FilesMatch \"\\.php$\"&gt;\n#   SetHandler \"proxy:unix:\/run\/php-fpm\/www.sock|fcgi:\/\/localhost\/\"\n# &lt;\/FilesMatch&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"compression-and-caching\"><strong>Compression and caching<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Enable modules (Ubuntu\/Debian):\nsudo a2enmod deflate <a href=\"https:\/\/www.youstable.com\/blog\/how-to-add-expires-headers\/\">headers expires<\/a> brotli\nsudo systemctl reload apache2\n\n# Example rules (add inside vhost or a conf file):\nAddOutputFilterByType DEFLATE text\/html text\/plain text\/css application\/javascript application\/json\n# If Brotli installed:\n# AddOutputFilterByType BROTLI_COMPRESS text\/html text\/plain text\/css application\/javascript application\/json\n\n# Caching static assets:\nExpiresActive On\nExpiresByType image\/webp \"access plus 1 month\"\nExpiresByType image\/png \"access plus 1 month\"\nExpiresByType text\/css \"access plus 7 days\"\nExpiresByType application\/javascript \"access plus 7 days\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"connection-limits-and-keepalive\"><strong>Connection limits and KeepAlive<\/strong><\/h3>\n\n\n\n<p>Tune for your RAM\/CPU. As a starting point on a 2\u20134 GB VPS:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># event MPM example (Ubuntu: \/etc\/apache2\/mods-available\/mpm_event.conf)\n# RHEL: in \/etc\/httpd\/conf.modules.d\/ prefixed file or main httpd.conf\n&lt;IfModule mpm_event_module&gt;\n   StartServers             2\n   MinSpareThreads         25\n   MaxSpareThreads         75\n   ThreadLimit             64\n   ThreadsPerChild         25\n   MaxRequestWorkers      150\n   MaxConnectionsPerChild   0\n&lt;\/IfModule&gt;\n\nKeepAlive On\nMaxKeepAliveRequests 100\nKeepAliveTimeout 5<\/code><\/pre>\n\n\n\n<p>Measure with real traffic and adjust. Always reload after changes and monitor <a href=\"https:\/\/www.youstable.com\/blog\/fix-high-physical-memory-usage-in-cpanel\/\">memory usage<\/a> to prevent swapping.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"logs-monitoring-and-maintenance\"><strong>Logs, Monitoring, and Maintenance<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access logs: <code>\/var\/log\/apache2\/access.log<\/code> or <code>\/var\/log\/httpd\/access_log<\/code><\/li>\n\n\n\n<li>Error logs: <code>\/var\/log\/apache2\/error.log<\/code> or <code>\/var\/log\/httpd\/error_log<\/code><\/li>\n\n\n\n<li>Service logs: <code>journalctl -u apache2<\/code> or <code>journalctl -u httpd<\/code><\/li>\n\n\n\n<li>Tail live logs: <code>sudo tail -f \/var\/log\/apache2\/error.log<\/code><\/li>\n\n\n\n<li>Log rotation: handled by logrotate; verify configs in <code>\/etc\/logrotate.d\/<\/code><\/li>\n<\/ul>\n\n\n\n<p>For traffic insights, tools like GoAccess provide real-time reports from access logs without adding overhead to Apache.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"troubleshooting-common-issues\"><strong>Troubleshooting Common Issues<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Port already in use: <code>sudo ss -tulpn | grep :80<\/code> to find conflicts. Stop the other service or change Apache\u2019s <code>Listen<\/code> port in <code>ports.conf<\/code> (Ubuntu) or <code>httpd.conf<\/code> (RHEL).<\/li>\n\n\n\n<li>403 Forbidden: Check file permissions\/ownership and Apache <code>&lt;Directory&gt;<\/code> rules. On SELinux, ensure contexts are correct and use <code>restorecon<\/code>.<\/li>\n\n\n\n<li>500 Internal Server Error: Inspect the error log for .htaccess syntax or PHP errors. Test with <code>apachectl -t<\/code>.<\/li>\n\n\n\n<li>Changes not applied: Use <code>systemctl reload<\/code> (graceful) after config edits; verify with <code>apachectl -t<\/code>.<\/li>\n\n\n\n<li>Slow site: Enable compression, caching, switch to event MPM, and use PHP-FPM. Profile the app and database, not just Apache.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"optional-build-a-full-lamp-stack\"><strong>Optional: Build a Full LAMP Stack<\/strong><\/h2>\n\n\n\n<p>Adding PHP and a database turns your server into a LAMP stack for WordPress and dynamic apps:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Ubuntu\/Debian:\nsudo apt install -y php php-fpm php-mysql mariadb-server\n\n# RHEL-based:\nsudo dnf install -y php php-fpm php-mysqlnd mariadb-server\nsudo systemctl enable --now mariadb<\/code><\/pre>\n\n\n\n<p>Prefer PHP-FPM with Apache\u2019s event MPM for better concurrency than mod_php.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"when-to-use-youstable-for-apache-hosting\"><strong>When to Use YouStable for Apache Hosting<\/strong><\/h2>\n\n\n\n<p>If you\u2019re running production workloads, a reliable platform matters. YouStable\u2019s SSD-powered VPS and dedicated servers deliver consistent I\/O, DDoS protection, IPv6 support, and free Let\u2019s Encrypt SSL. Our engineers can pre-harden Apache, configure PHP-FPM, and set up automated backups\u2014so you focus on your website, not server firefighting.<\/p>\n\n\n\n<p>By following the steps above, you now know how to setup Apache on Linux server from installation to SSL, security, and tuning. With a solid foundation and the right hosting, Apache can power fast, secure, and scalable websites.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"faqs-how-to-setup-apache-on-linux-server\"><strong>FAQs: How to Setup Apache on Linux Server<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1765793117847\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"is-apache-or-nginx-better-for-wordpress-on-linux\"><strong>Is Apache or Nginx better for WordPress on Linux?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Both work well. Apache offers flexible .htaccess and deep module support. Nginx excels at handling static assets and high concurrency. A common production pattern is Nginx as a reverse proxy in front of Apache+PHP-FPM, or Apache alone with event MPM and caching. Choose based on your stack and team expertise.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765793127962\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-change-apaches-default-port-from-80\"><strong>How do I change Apache\u2019s default port from 80?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Ubuntu\/Debian: edit <code>\/etc\/apache2\/ports.conf<\/code> and VirtualHost to match, e.g., <code>Listen 8080<\/code> and <code>&lt;VirtualHost *:8080&gt;<\/code>. RHEL-based: update <code>\/etc\/httpd\/conf\/httpd.conf<\/code> and vhosts. Reload the service and open the new port in your firewall.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765793133063\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-can-i-host-multiple-websites-on-one-apache-server\"><strong>How can I host multiple websites on one Apache server?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use Virtual Hosts. Create separate document roots and vhost files for each domain. On Ubuntu\/Debian, place configs in <code>sites-available<\/code> and enable with <code>a2ensite<\/code>. On RHEL-based systems, add one <code>.conf<\/code> per site in <code>\/etc\/httpd\/conf.d\/<\/code>. Point DNS A\/AAAA records to your server\u2019s IP.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765793147163\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-auto-renew-lets-encrypt-certificates-on-apache\"><strong>How do I auto-renew Let\u2019s Encrypt certificates on Apache?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Certbot sets up a systemd timer by default. Verify with <code>systemctl list-timers | grep certbot<\/code> and run a dry-run: <code>sudo certbot renew --dry-run<\/code>. Ensure your firewall allows TCP 80\/443 and your domain points to the server so HTTP-01\/ALPN can validate.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765793155879\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"where-are-apache-configuration-files-on-linux\"><strong>Where are Apache configuration files on Linux?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Ubuntu\/Debian stores configs in <code>\/etc\/apache2\/<\/code> (sites in <code>sites-available<\/code>\/<code>sites-enabled<\/code>) with logs in <code>\/var\/log\/apache2\/<\/code>. RHEL\/CentOS\/AlmaLinux\/Rocky use <code>\/etc\/httpd\/<\/code> (vhosts in <code>conf.d<\/code>) with logs in <code>\/var\/log\/httpd\/<\/code>. The main files are <code>apache2.conf<\/code> or <code>httpd.conf<\/code>.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>To set up Apache on a Linux server, install the apache2\/httpd package, enable and start the service, allow ports 80\/443 [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":15477,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[350],"tags":[],"class_list":["post-13326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/How-to-Setup-Apache-on-Linux-Server.jpg","author_info":{"display_name":"Prahlad Prajapati","author_link":"https:\/\/www.youstable.com\/blog\/author\/prahladblog"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=13326"}],"version-history":[{"count":3,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13326\/revisions"}],"predecessor-version":[{"id":15478,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13326\/revisions\/15478"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/15477"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=13326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=13326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=13326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}