我在生产中有一个Web应用程序(使用Vuejs),并使用nginx作为代理。我不想在浏览器控制台中显示日志。我尝试:
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log /dev/null;
error_log /dev/null;
access_log off;
error_log off;
root /usr/share/nginx/html;
index index.html;
server_name you.server.com;
location / {
try_files $uri $uri/ @rewrites; }
location @rewrites {
rewrite ^(.+)$ /index.html last; }
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; }
}
答案 0 :(得分:0)
Nginx无法控制向浏览器控制台的输出!
只需从代码中删除控制台日志。
仅供参考:如果您愿意
在浏览器控制台中删除“您正在使用Vue的开发版本”,可以通过running Vue in production mode
// make sure to set this synchronously immediately after loading Vue
Vue.config.devtools = false;
// make sure to set this synchronously immediately after loading Vue
Vue.config.devtools = false;