sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1
sudo apt-cache search php7.1
sudo apt-get install php7.1 php7.1-cli php7.1-common php7.1-pgsql php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm
This solved my issues
sudo apt-get install php7.1-xml
php --ini |grep Loaded
Loaded Configuration File: /etc/php/7.1/cli/php.ini
Edit the file using your favorite text editor:
sudo nano /etc/php/7.1/cli/php.ini
Make the following changes:
cgi.fix_pathinfo=0
Then, restart the PHP-FPM service:
sudo systemctl restart php7.1-fpm.service
sudo apt-get install nginx
server {
listen 80;
listen [::]:80;
root /var/www/html/MyProject/public;
index index.php index.html index.htm;
server_name example.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Check if there are errors with the configuration:
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
If the syntax is OK and there are no errors you can restart Nginx.
sudo systemctl restart nginx.service
Enable Nginx and PHP-FPM on system boot:
sudo systemctl enable nginx.service
sudo systemctl enable php7.1-fpm.service
sudo curl -O sudo curl -O https://getcomposer.org/composer.phar
sudo mv composer.phar composer
sudo mv composer /usr/local/bin/
clone project tu github ve
chay composer install hoac composer update chay yarn install mv env.example to .env
-Permit Laravel
sudo chown -R :www-data /var/www/laravel
sudo chmod -R 775 /var/www/laravel/storage
sudo chmod -R 775 /var/www/laravel/bootstrap/cache
sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache
then to set directory permission try this:
chmod -R 775 storage
chmod -R 775 bootstrap/cache
Update:
Webserver user and group depend on your webserver and your OS. to figure out what's your web server user and group use the following commands. for nginx use:
ps aux|grep nginx|grep -v grep
sudo service php7.1-fpm restart
sudo service php7.1-fpm status
refs: https://websiteforstudents.com/install-laravel-on-ubuntu-17-04-17-10-with-nginx-mariadb-and-php-support/ https://www.rosehosting.com/blog/install-php-7-1-with-nginx-on-an-ubuntu-16-04-vps/ https://medium.com/@sagarnasit/deploy-laravel-application-with-lemp-stack-ubuntu-and-enginx-e82a4445b3d2 https://www.youtube.com/watch?v=p_VwZTmyG5o