Install Nginx and Apache together Print

  • 0

Running Nginx on port 80 and Apache on port 8081

Since Nginx is on port 80, you should tell nginx to forward all php requests to apache on port 8081. For that add the domain virtual host entry as below :

=============================

server {
listen 80;
# listen *:80;
server_name arun.in;

location / {
root /home/arun/public_html/;
index index.html index.htm;
}

location ~ \.php$ {

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8081;

}

location ~ /\.ht {
deny all;
}
}


=============================


Once this is done, add the virtual host entry in apache.

==============================

<VirtualHost 127.0.0.1:8081>
ServerAdmin arun@ffff.com
DocumentRoot "/home/arun/public_html"
ServerName arun.in
ServerAlias www.arun.in
ErrorLog "logs/arun.in/error_log"
CustomLog "logs/arun.in/access_log" common
</VirtualHost>

==============================

If you have not yet installed php, folow the link here.

Restart Apache and Nginx.



Was this answer helpful?

« Back

Powered by WHMCompleteSolution