删除Apache2
$ sudo service apache2 stop $ sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common $ sudo apt-get autoremove $ whereis apache2 $ sudo rm -rf /etc/apache2
安装nginx
apt-get install build-essential git gcc g++ make wget "http://bit.ly/1Z0nKld" wget "http://bit.ly/1Z0nKlf" wget "http://bit.ly/1Z0nMta" wget "http://bit.ly/1QgFmrr" git clone http://bit.ly/1QgFoPZ git clone http://bit.ly/1QgFmrs tar xzvf nginx-1.7.8.tar.gz tar xzvf pcre-8.38.tar.gz tar xzvf openssl-1.0.1j.tar.gz tar xzvf zlib-1.2.8.tar.gz cd nginx-1.7.8 ./configure \ --prefix=/usr/local/nginx \ --with-pcre=../pcre-8.38 \ --with-openssl=../openssl-1.0.1j \ --with-zlib=../zlib-1.2.8 \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_ssl_module \ --with-http_spdy_module \ --with-http_gzip_static_module \ --with-ipv6 \ --with-http_sub_module \ --add-module=../ngx_http_google_filter_module \ --add-module=../ngx_http_substitutions_filter_module make make install
配置nginx
server { server_name scholar.google.com; resolver 8.8.8.8; location / { proxy_pass http://bit.ly/1QgFoQ0; } }
重启nginx:
/usr/local/nginx/sbin/nginx -s reload
报错代码:
nginx: [error] open() “/usr/local/nginx/logs/nginx.pid” failed (2: No such file or directory)
解决方法:
1.重新运行一下:
/usr/local/nginx/sbin/nginx
2.重启nginx:
/usr/local/nginx/sbin/nginx -s reload
3.运行:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confvia Chu's Space http://bit.ly/1Z0nMtd