Install nginx on linux

Step 1: Install Nginx Package in Linux
yum install nginx
Step 2: Install php php-fpm Package in Linux
yum install php php-mysql php-cli php-xmlprc php-fpm
Step 3: Start your php-fpm restart
service php-fpm restart
Step 4: Edit your below file Like /etc/php.fpm.d/www.conf
Content:
Comment Line: #listen = 127.0.0.1:9000
Add Line: listen = /var/run/php-fpm.sock
Step 5: Edit your /etc/php.ini file by using Below content
Content:
Comment Line: # cgi.fix_pathinfo=1;
Add Line: cgi.fix_pathinfo=0;
Step 6: Create Directory in Below locations
Path: /var/www/html/testing
Command: mkdir /var/www/html/testing/
Step 7: Create new virtualhost file Like this /etc/nginx/conf.d/test1.conf
server {
listen 80;
server_name m.hello.com;
root /var/www/html/testing/;
index index.php;
error_page 404 /404.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Step 8: Add your Host file in Linux /etc/hosts file
Path: /etc/hosts
Content:
192.168.1.2 www.compufytechnolab.com

Leave a comment