Hello to all !
its not working for me ! can you please help me ! @daghan @JoshData i need to active php for my domains !
here are the steps I have taken
Created the /home/user-data/www/example.com.conf file (with my domain replaced of course) as explained by Norman
then set up all the folders for the new domain chown user-data
Then run "sudo ./mailinabox/tools/web_update"
but it seems like the update is not working on the console
root@box:~/mailinabox/tools# sudo ./web_update
root@box:~/mailinabox/tools#
Suggestions ?
Thnak you guys !!!
SOLUTION FOR PHP
Configure php
We need to make one small change in the php configuration.Open up php.ini:
sudo nano /etc/php5/fpm/php.ini
Find the line, cgi.fix_pathinfo=1, and change the 1 to 0.
cgi.fix_pathinfo=0
If this number is kept as 1, the php interpreter will do its best to process the file that is as near to the requested file as possible. This is a possible security risk. If this number is set to 0, conversely, the interpreter will only process the exact file path—a much safer alternative. Save and Exit. We need to make another small change in the php5-fpm configuration.Open up www.conf:
` sudo nano /etc/php5/fpm/pool.d/www.conf`
Find the line, listen = 127.0.0.1:9000, and change the 127.0.0.1:9000 to /var/run/php5-fpm.sock.
listen = /var/run/php5-fpm.sock
Save and Exit.
Restart php-fpm:
sudo service php5-fpm restart
Configure nginx
Open up the default virtual host file.
sudo nano /etc/nginx/sites-available/default
The configuration should include the changes below (the details of the changes are under the config information):
UPDATE: Newer Ubuntu versions create a directory called ‘html’ instead of ‘www’ by default. If /usr/share/nginx/www does not exist, it’s probably called html. Make sure you update your configuration appropriately.
server {
listen 80;
root /usr/share/nginx/www;
index index.php index.html index.htm;
server_name example.com;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Here are the details of the changes:
Add index.php to the index line.
Change the server_name from local host to your domain name or IP address (replace the example.com in the configuration)
Change the correct lines in “location ~ .php$ {“ section
Save and Exit
Create a php Info Page. We can quickly see all of the details of the new php configuration.
To set this up, first create a new file:
sudo nano /usr/share/nginx/www/info.php
Add in the following line:
<?php
phpinfo();
?>
Then Save and Exit.
Restart nginx
sudo service nginx restart
You can see the nginx and php-fpm configuration details by visiting http://youripaddress/info.php