×
Community Blog How to Create a Virtual Host on Apache Server for Phabricator

How to Create a Virtual Host on Apache Server for Phabricator

When you setup an application, you need to create a virtual host for the access. In this tutorial, you will learn how to create a virtual host with commands for your apps.

Phabricator is a free and open source collection of web applications that helps you to build your own software development platform for better software. And when you want to host Phabricator, you may need to create a virtual host for the access. In this article, you will learn how to create a virtual host on the apache server with commands for Phabricator.

For how to prepare your system and LAMP stack, and how to install Phabricator on an Alibaba Cloud Elastic Compute Service (ECS) CentOS 7 server, please go to Create Your Own Software Development Platform using Phabricator on CentOS 7.

And now Alibaba Cloud has good offers for easy-to-use high-performance virtual machines with a massive free data transfer. Just $2.50 a month makes you benefit from all advantages of SSD cloud server for your web applications through the new packages, which not only offer you SSD cloud server but also including a data transfer plan that you must need. Come and Check the packages!

After you have installed Phabricator on the apache server, you can create a new virtual host file with the following command.

nano /etc/httpd/conf.d/yourdomain.com.conf

Replace yourdomain.com with your actual domain. Now add the following content into the file.

<VirtualHost *:80>  
    ServerName yourdomain.com
    Redirect permanent / https://yourdomain.com/
    TransferLog /var/log/httpd/yourdomain.com_access.log
    ErrorLog /var/log/httpd/yourdomain.com_error.log
</VirtualHost>

<VirtualHost *:443>  
    ServerName yourdomain.com
    DocumentRoot /var/www/phabricator/phabricator/webroot
    ServerAdmin me@liptanbiswas.com
    SSLEngine On
    SSLCertificateFile /etc/letsencrypt/live/yourdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem
    RewriteEngine on
    RewriteRule ^/rsrc/(.*)     -                       [L,QSA]
    RewriteRule ^/favicon.ico   -                       [L,QSA]
    RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]

    <Directory /var/www/phabricator/phabricator/webroot>
        AllowOverride All
        Require all granted
    </Directory>    
    
    TransferLog /var/log/httpd/yourdomain.com_ssl_access.log
    ErrorLog /var/log/httpd/yourdomain.com_ssl_error.log
</VirtualHost>

In the above configuration change yourdomain.com to your actual domain.

Finally, restart the apache server and MariaDB to apply all the changes that we just configured. You can do so using the following commands.

systemctl restart httpd
systemctl restart mariadb

You will need to disable SELinux otherwise, Phabricator won't be able to connect to the database. To temporary disable SELinux without restarting the server, run the following command.

setenforce 0

Related Blog Posts

How to Install and Configure Redmine on CentOS 7

To access Redmine via your server’s IP address, you will be required to set up a virtual host.

Open the apache configuration file /etc/httpd/conf.d/welcome.conf

# sudo nano /etc/httpd/conf.d/welcome.conf

Remove all the code available in opened file.

Add the following lines of code in opened apache configuration file and press Ctrl+X, then type Y and then hit Enter.

<VirtualHost *:3000>
    ServerName 47.89.180.149
    DocumentRoot /var/www/html/public/
    PassengerRoot /home/aareez/.rvm/gems/ruby-2.4.1/gems/passenger-5.3.1
    PassengerRuby /home/aareez/.rvm/gems/ruby-2.4.1/wrappers/ruby
    PassengerUser aareez

    <Directory /var/www/html/public/>
      Allow from all ExecCGI
      Options -MultiViews
      Require all granted
    </Directory>
</VirtualHost>

Restart apache.

# sudo service httpd restart

How to Deploy Magento 2 on CentOS 7 with ECS and ApsaraDB

After you have installed Varnish Cache, please create a new Apache virtual host to serve the application using your domain name.

sudo nano /etc/httpd/conf.d/shop.example.com.conf

Add the following content to the file.

<VirtualHost *:8080>
    ServerName shop.example.com
    DocumentRoot /var/www/magento2
    <Directory /var/www/magento2>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Make sure you change shop.example.com with your actual domain name. Now, restart Varnish cache and Apache web servers.

sudo systemctl restart httpd
sudo systemctl restart varnish

Related Documentation

How to configure websites and bind domain names for ECS Linux instances

In this article, you will learn the following processes:

  1. Bind a domain name to Nginx service
  2. Bind a domain name to Tomcat service
  3. Bind a domain name to Apache service
  4. Configure Apache service for navigation among multiple domain names
  5. Configure a second-level domain name for Apache service
  6. Forbid unauthorized domain name to access websites on ECS by Apache

Host monitoring overview

Host monitoring is available for both Alibaba Cloud ECS servers, and virtual and physical machines provided by other vendors.

Host monitoring collects statistics of a diverse range of OS-related metrics by using the agent, allowing you to retrieve the server resource usage and obtain metrics for troubleshooting.

Related Market Products

Genymotion Cloud: Android 9.0 (pie)

PaaS Android Operating System. It offers Android Virtual Machines with high quality display in your web browser as well as SSH and ADB access.

Array Networks vxAG - 50 Concurrent Users + 5 Virtual Portal

Array’s vxAG is the Ideal choice for AliCloud users who are seeking scalable and flexible secure access from PC, iOS and Android. Array’s vxAG provide AliCloud users the most reliable and secure access through SSL VPN.

Related Products

Elastic Compute Service

An online computing service that offers elastic and secure virtual cloud servers to cater all your cloud hosting needs.

Virtual Private Cloud

A virtual private cloud service that provides an isolated cloud network to operate resources in a secure environment.

0 0 0
Share on

Alibaba Clouder

2,599 posts | 764 followers

You may also like

Comments