以下是 /etc/nginx/site-enables/joomla 的設定
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
//不記錄 favicon 相關的錯誤訊息
location = /favicon.ico { access_log off; log_not_found off; }
// location 符合 / 就不再往下層
location = / {
root /var/www;
# index index.php index.html index.htm;
#try_files $uri = /index.php;
}
location /doc {
root /usr/share;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex on;
}
// 子目錄
location /phpmyadmin {
// 目錄起點
root /var/www/phpmyadmin;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
#try_files $uri =404;
index index.php index.html index.htm;
#fastcgi_pass unix:/tmp/php.socket;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
//僅接受 .144 連線
allow 192.168.0.144;
deny all;
}
location /joomla {
root /var/www/joomla;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
index index.php index.html index.htm;
#try_files $uri =404;
#fastcgi_pass unix:/tmp/php.socket;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
//接受整個網段的連線
allow 192.168.0.0/24;
deny all;
}
}
//Vhost
server {
listen 80;
server_name www.rodcap.co.uk;
access_log /var/log/nginx/rodcap.access.log;
error_log /var/log/nginx/rodcap.error.log;
root /var/www/joomla;
index index.php index.html index.htm;
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
keepalive_timeout 0;
#fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
#try_files $uri =404;
#fastcgi_pass unix:/tmp/php.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
沒有留言:
張貼留言