梅林固件安装Nginx

原文地址:https://www.hqt.ro/nginx-web-server-with-php-support-through-entware/

1. Install Entware fromhere

entware-setup.sh

2. Update entware

opkg update
opkg upgrade

3. Install nginx

opkg install nginx php5-cgi

4. Backup default configuration file

mv /opt/etc/nginx/nginx.conf /opt/etc/nginx/nginx.conf-orig

5. Create nginx configuration file, copy/paste in terminal

cat >> /opt/etc/nginx/nginx.conf << 'EOF'
user nobody;
worker_processes 1;
events {
worker_connections 64;
}
http {
include mime.types;
include /opt/etc/nginx/sites-enabled/*;
default_type application/octet-stream;
server {
listen 82;
server_name localhost;
location / {
root /opt/share/nginx/html;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /opt/share/nginx/50x.html {
root html;
}
location ~ \.php$ {
root /opt/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
EOF

Press Enter

9. Start serve

/opt/etc/init.d/S80nginx start

你可能感兴趣的:(梅林固件安装Nginx)