[script perl] mon navigateur n'exécute pas les scripts perl.
Publié : mar. 03 nov. 2015, 04:09
Salut à tous,
Tout est dans le titre…quand j'essaye d’exécuter un script perl, mon navigateur me propose de l'ouvrir au lieu de l'exécuter.
Adresse du script :
https://ignace72.eu/test.cgi
Mon nginx.conf
À titre d'info, j'ai perl-cgi installé.
Merci.
Tout est dans le titre…quand j'essaye d’exécuter un script perl, mon navigateur me propose de l'ouvrir au lieu de l'exécuter.
Adresse du script :
https://ignace72.eu/test.cgi
Code : Tout sélectionner
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Perl Environment Variables</title></head>
<body>
<h1>Perl Environment Variables</h1>
EndOfHTML
foreach $key (sort(keys %ENV)) {
print "$key = $ENV{$key}<br>\n";
}
print "</body></html>";
Code : Tout sélectionner
user http;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
#HSTS
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains";
sendfile on;
#tcp_nopush on;
error_log /var/log/nginx/error.log;
server_tokens off;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
# désactivation de la compression pour les navigateur ne la prenant pas en charge (IE < 6)
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;
gzip_comp_level 3;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/json application/x-javascript application/xml application/xml+rss text/javascript;
server {
listen 80;
server_name ignace72.eu;
rewrite ^ https://$server_name$request_uri? permanent;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /srv/http;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /srv/http;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl spdy;
server_name localhost ignace72.eu;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/ssl/serveur.crt ;
ssl_certificate_key /etc/ssl/serveur.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_dhparam /etc/ssl/dhparams.pem;
ssl_stapling on;
ssl_stapling_verify on;
location / {
root /srv/http;
index index.html index.htm index.php;
}
error_page 404 /404.html;
location = /404.html {
root /srv/http;
}
error_page 403 /403.html;
location = /403.html {
root /srv/http;
}
location ~ \.php$ {
root /srv/http;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS on;
fastcgi_param PHP_ADMIN_VALUE open_basedir="/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/";
include fastcgi.conf;
}
location ^~ /awstats-icon {
alias /usr/share/webapps/awstats/icon/;
access_log off;
}
location ^~ /awstatscss {
alias /usr/share/webapps/awstats/examples/css/;
access_log off;
}
location ^~ /awstatsclasses {
alias /usr/share/webapps/awstats/examples/classes/;
access_log off;
}
location ~ ^/cgi-bin/.*\.(cgi|pl|py|rb) {
gzip off;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index cgi-bin.php;
fastcgi_param SCRIPT_FILENAME /etc/nginx/cgi-bin.php;
fastcgi_param SCRIPT_NAME /cgi-bin/cgi-bin.php;
fastcgi_param X_SCRIPT_FILENAME /usr/share/webapps/awstats$fastcgi_script_name;
fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REMOTE_USER $remote_user;
}
}
}
#
# Directives to allow use of AWStats as a CGI
#
# Alias /awstatsclasses "/home/ignace/wwwroot/classes/"
# Alias /awstatscss "/home/ignace/wwwroot/css/"
# Alias /awstatsicons "/home/ignace/wwwroot/icon/"
# ScriptAlias /awstats/ "/home/ignace/wwwroot/cgi-bin/"
#
#
# This is to permit URL access to scripts/files in AWStats directory.
#
# <Directory "/home/ignace/wwwroot">
# Options None
# AllowOverride None
# Order allow,deny
# Allow from all
# </Directory>
Merci.