Each error document was created and placed in the errors folder. The paths shown are relative to the DocumentRoot folder defined previously. If error messages are not defined, Apache generates its own error pages. Custom error pages are more user friendly and can be customized as much, or as little, as you want.
Define ServerSignature to specify whether the server details are displayed in any server-generated error pages or index lists. Options are On, Off, and Email. The level of detail in the signature is configured via ServerTokens, which cannot be set in the Virtual Hosts file. Enable the cgi-bin location as defined by the custom virtual hosts layout. You can leave cgi-bin in the DocumentRoot location if you so want. Set the options for the specified directory.
The following example enables the FollowSymLinks option for the public directory of domain. Enable or disable the option to follow symlinks. Be careful with this option because it can lead to security risks inadvertently linking to configuration folders. This prevents many of the security risks that a simple FollowSymlinks directive can create.
Your file pathway displays in the place holder. After you receive a positive response, you need to reload or restart Nginx bu using one of the following commands:. Note : If you run php-fpm , you need to restart that service as well, by using the following command:.
In CentOS, you manually need to comment out the vhost you want to disable. Depending on your particular setup, the preceding output might look different. However, the pathway you are looking for should end similarly to domain. After you have the location of the virtual host, open the vhost configuration file with your favorite text editor.
Here are two examples using vim and nano :. Edit the configuration file and add a pound sign in front of each line for the vhost entry. If you are using vim , enter Insert mode first.
Your vhost configuration should now look like this:. Finally, either reload or restart Apache. If you are using CentOS 7 or later, you can use systemctl for this command.
Now that we have our first virtual host file established, we can create our second one by copying that file and adjusting it as needed. You now need to modify all of the pieces of information to reference your second domain. The final file should look something like this, with highlighted text corresponding to your own relevant domain information.
With our virtual host files created, we must enable them. When you are finished, you need to restart Apache to make these changes take effect and use systemctl status to verify the success of the restart.
For a local Windows machine, find instructions on altering your hosts file here. Save and close the file. This will direct any requests for example. Now that you have your virtual hosts configured, you can test your setup by going to the domains that you configured in your web browser:.
We are thankful for your never ending support. Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published. Save my name, email, and website in this browser for the next time I comment. Notify me of followup comments via e-mail. You can also subscribe without commenting.
0コメント