Add a configuration blocks that look like this (make sure that you have amended the paths accordingly to your username and domain): Feel free to comment it out or delete it. This file comes with some example configuration that we don’t need. Open this file via the text editor of your choice. We need to add a custom configuration to its configuration file that is located under /etc/apache2/extra/nf. We are done here! old: AllowOverride Noneĭo you remember vhost (Virtual Host) that we enabled second ago? We have to configure that in a way that our localhost serves files from ~/Sites and wp.localhost from ~/Sites/wp.localhost. Edit the value of AllowOverride from None to All. The AllowOverride controls section of the configuration file allows us to enable the use of. To easily change the server configuration on a per-directory basis, Apache uses. New: DocumentRoot "/Users/pawelgrzybek/Sites/" Please, be sure to change the name of your username folder - the chances that your directory is called pawelgrzybek are slim! old: DocumentRoot "/Library/WebServer/Documents" The default root directory for the Apache server is /Library/WebServer/Documents. It is not a requirement, just a convention. Personally I store the source files to all websites that I am working on inside a Sites folder in my home directory. New: LoadModule php7_module libexec/apache2/libphp7.soĬhange the default location for our projects old: #LoadModule php7_module libexec/apache2/libphp7.so It is as easy as uncommenting LoadModule php7_module libexec/apache2/libphp7.so. That being so our server surely needs to know how to deal with. New: LoadModule rewrite_module libexec/apache2/mod_rewrite.so old: #LoadModule rewrite_module libexec/apache2/mod_rewrite.so Uncomment LoadModule rewrite_module libexec/apache2/mod_rewrite.so. Wouldn’t it be cool to simplify it to /about? This is the reason why we need to explicitly enable it. In the case of WordPress we will more likely see something like /?p=1. For example the URL to a page about your company may end up being /about.php. New: Include /private/etc/apache2/extra/nfīy default mod_rewrite follows the filesystem path. Old: #Include /private/etc/apache2/extra/nf New: LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so old: #LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so To enable it uncomment LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so and Include /private/etc/apache2/extra/nf inside your Apache configuration file. Virtual Host is a term that describes exactly this functionality. somewebsite.localhost or anotherone.localhost). There is a chance that you are going to work on multiple WordPress projects in the future and it would be cool to access them via custom domains (i.e. Change the default location for our projects. We need to proceed with a few tweaks here: This is the main Apache configuration file that contains tons of helpful comments about all the available directives. Superuser privileges ( sudo) will be needed. To do so, feel free to use your favourite text editor such as nano, vim, subl or my beloved code. apachectl -vīefore we run the server we need to make a tiny adjustment in its configuration file. You can confirm they are installed by checking the current version for each of them in the command line. The Apache HTTP Server and PHP language are already on your machine. Configure an Apache HTTP server and enable PHP An Apache HTTP server, MySQL database and PHP programming language is all that we need and, believe it or not, your Apple computer comes with the majority of these elements baked in. My approach is a little bit more complicated but gives you enough knowledge about the environment to walk away confidently. There is one disadvantage though - applications like these hide lots of important details from the user and come pre-bundled with lots of stuff that you just don’t need to run a WordPress website. Smashing Magazine published an article called “WordPress Local Development For Beginners: From Setup To Deployment” by Nick Schäferhoff which is a great guide that takes you through the journey when using these kinds of tools. Great choice, it is a fantastic piece of software! There are plenty of tools that let you set it up in no time at no cost - MAMP / XAMPP and Local by FlyWheel are probably the best choices for beginners. So you are a macOS user and you want to configure a local environment to build a WordPress project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |