create project and verify with normal url

mkdir /var/www/html/myproject

vim index.html

<h1>Hello World</h1>

vim index.php



Create server block conf file

vim /etc/nginx/conf.d/myproject.conf

server {
  listen 8082 default_server;
  server_name _;

  index index.php index.html;

  root /var/www/html/myproject;

  location ~ \.php$
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

Test nginx configuration

nginx -t

restart nginx

sudo service nginx restart
sudo systemctl restart nginx

For Laravel Project
Specify path till public directory

Leave a Reply

Your email address will not be published. Required fields are marked *