How install Ubuntu Server 18, PHP 7.4, MySQL and Nginx
How install Ubuntu Server 18 and Nginx
1 Download Ubuntu Server
Download ubuntu 18 server fron this url: download You should download Server Installation image.
Install ubuntu server like you usually install using a booting usb or CD.
3 Installing Nginx
4.1 Seting password
Confirm password and press enter.
This password will be your MySQL root password.
Will ask if you wish disable remove anonymous user, you can to type "Y".
Will ask if you wish remove test data base and access to it, type "y".
To test your acces type command:
Will ask your root password previously saved.
5 Installing PHP 7.4 with FPM
You will want to avoid relying on the default version of PHP because that default version could change depending on where you are running your code. You may also wish to install a different version to match an application you are using or to upgrade to a newer version, such as PHP 8.
Next, install software-properties-common, which adds management for additional software sources:
The -y flag will automatically agree to the installation. Without that, you would receive a prompt in your terminal window for each installation.
Next, install the repository ppa:ondrej/php, which will give you all your versions of PHP:
You update apt-get again so your package manager can see the newly listed packages:
Installing PHP 7.4 FPM
7 If you have installed more than one PHP version of the same pack
Check php version using
php -v
Type this command and select your cli version
5 Setting Ngnix
If we have installed web application on a local folder of your remote user’s home directory, and while this works well for local development environments, it’s not a recommended practice for web servers that are open to the public internet. We’ll move the application folder to /var/www, which is the usual location for web applications running on Nginx.
Now we need to give the web server user write access to the storage and cache folders, where stores application-generated files, in this case we will acces to main forlder application by example.
You will see a change over permision like this.
The application files are now in order, but we still need to configure Nginx to serve the content. To do this, we’ll create a new virtual host configuration file at /etc/nginx/sites-available:
Create a new file with your site name, example:
Set this configuration, adjust for you preferences.
To confirm that the configuration doesn’t contain any syntax errors, you can use:
You should see output like this:
To apply the changes, reload Nginx with:
Now go to your browser and access the application using the server’s domain name or IP address, as defined by the server_name directive in your configuration file:
http://server_domain_or_IP
Thanks for read this tutorial leave your comments.
References:
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-lemp-on-ubuntu-18-04
https://www.cyberciti.biz/faq/install-and-configure-nginx-on-ubuntu-linux-18-04-lts/
Comments
Post a Comment