padavan下载源
http://h5ppt.com/bin.entware.net/mipselsf-k3.4/
用winscp连接路由器后在/opt/etc/找到opkg.con
打开后将原来的地址换成上面的地址
如果没有/opt/var/run/nginx.pid看下面链接
谁掳走了 nginx.pid 文件?
nginx日志报错文件在/opt/var/log/nginx
参考文章
Nginx出现403 forbidden
下面开始安装nginx
首先opkg install nginx-extras
安装好后用winscp连接路由器
修改/opt/etc/nginx/nginx.conf中第一行user
将nobody 改成user admin root;
参考
https://blog.csdn.net/u011066470/article/details/122279857
https://www.right.com.cn/forum/thread-753365-1-1.html
/opt/etc/nginx/nginx.conf完整文件如下
user admin root;
worker_processes auto;
pid /opt/var/run/nginx.pid;
include /opt/etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /opt/etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /opt/var/log/nginx/access.log;
error_log /opt/var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /opt/etc/nginx/conf.d/*.conf;
include /opt/etc/nginx/sites-enabled/*;
server {
listen 81;
server_name localhost;
root /opt/share/www/;
#index index.html index.htm index.php tz.php;
location / {
index index.html index.htm index.php l.php;
autoindex off;
}
}}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
打开opt/etc/nginx/sites-available
找到defalut文件双击打开后如下
修改listen 将原来的80改为81
最后在ssh界面启动nginx
/opt/etc/init.d/S80nginx start
参考文章
openwrt 安装nginx 冲突
Nginx 安装后 /etc/init.d/ 没有nginx 配置得启动服务
Nginx通过/etc/init.d/nginx方式启动或停止服务
启动Nginx出现Failed to start nginx.service:unit not found
斐讯K2P刷OpenWrt,并使用Nginx做服务,添加ssl
老毛子Padavan一键安装LNMP后部署自建网站教程(例子: mayswind的Aria-Ng新Web前端 )
修改nginx配置文件
打开/opt/etc/nginx/vhost复制一份配置
家用存储折腾之9-OpenWrt安装web环境(nginx+php)
老毛子固件ONMP自动覆盖NGINX配置怎么办
/opt/etc/nginx/vhost/default.conf修改后保存重启服务后还变成默认的,直接修改\opt\etc\nginx\nginx.conf这个配置还不会生效
opt/etc/nginx/sites-available
完整文件如下
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
##
# Default server configuration
#
server {
listen 81 default_server;
listen [::]:81 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /opt/share/www;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/opt/var/run/php7-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /opt/share/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}