The latest method of Linux configuration pac-solve the problem that the new version of chrome cannot be used
Preface
Because of the convenience, I want to configure pac in deepin today, which really makes my head burst. After sitting in front of the computer for a long time, I finally got it out.
story
In the beginning, I fiddled with a bunch of online tutorials, downloaded genpac, and generated a .pac file. I lost my mind and finally entered file://xxx/x.pac , I felt that I was finally done. Who knows, once chrome is turned on, it keeps spinning and spinning, and it's all in vain at the end.
I don't think it's right, I can't do it for others. So it was a bunch of random searching.
Finally, I finally found this sentence in the white web page: the
new version of chrome does not support the file protocol by default, so local files cannot be accessed. You can use the http protocol instead of
my god. The original posts are all old posts and they are all outdated. For nothing.
So I went to find a way to access the local site with http. Of course, it was a whole lot of mental journey. I won’t talk about it, just go to the method.
solve
The idea is to use nginx proxy forwarding
1. Download and install nginx
sudo apt-get install nginx
2. Modify the nginx.cnf configuration file.
Enter /etc/nginx to open nginx.cnf,
and enter in the http{...} code block:
server{
listen 80;
server_name 127.0.0.1;
location /auto.pac {
alias 绝对路径/auto.pac; #指atuo.pac文件的绝对路径
}
}
In fact, location and alias mean that when /auto.pac appears, use the absolute path /auto.pac instead
3. Modify the user name
in the nginx.cnf configuration file. At the beginning of the nginx.cnf file, the user name is changed to root:
user root;
4. Restart nginx
sudo systemctl restart nginx
Fill in the url: http://127.0.0.1/auto.pac
restart chrome to
complete, beautiful~