我爱编程

ubuntu配置备忘

2018-03-30  本文已影响0人  EarlHwong

更新软件

sudo apt-get update && sudo apt-get upgrade

出现

perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "zh_CN.UTF-8", ...... LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").

sudo apt-get install language-pack-zh-hans

出现

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

sudo echo "ServerName localhost:80" >> /etc/apache2/apache2.conf

Apache禁止访问目录浏览

/etc/apache2/apache2.conf

<Directory /home/git/www/>
   Options FollowSymLinks # 去掉 Indexes
   AllowOverride None
   Require all granted
</Directory>

Apache线程最大值(修改mpm)

/etc/apache2/mods-enabled/mpm_prefork.conf
修改至如下:

<IfModule mpm_prefork_module>
    StartServers             100
    MinSpareServers          100
    MaxSpareServers          200
    ServerLimit              300
    MaxClients               300
    MaxRequestsPerChild   10000
    timeout                  30
</IfModule>

http://blog.csdn.net/houdaiye/article/details/52057058

Apache开启cgi

  1. /etc/apache2/sites-enabled/000-default.conf

    Include conf-available/serve-cgi-bin.conf #去掉注释
    
  2. 创建链接
    ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enaled

  3. 开启模块
    sudo a2enmod cgi && sudo service apache2 restart

  4. AddHandle
    <IfDefine ENABLE_USR_LIB_CGI_BIN>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
    AddHandler .cgi .pl .cgi-script
    </Directory>
    </IfDefine>

Apache更改目录

Apache自动部署项目

.git/hooks/post-update (chmod +x)

#!/bin/sh
unset GIT_DIR
wwwDir=/home/git/www
Dir=/home/git/www/jimeimei

if [ ! -d "${Dir}" ]
then
    cd $wwwDir
    git clone /home/git/repositories/jimeimei.git
    chmod o+rx jimeimei
else
    cd $Dir
    git pull origin master
fi

cd $Dir
chmod o+rx -R ./*
chmod o-rx -R .git

Ghost Blog

apache添加新端口,设置反向代理

  1. /etc/apache2/site-aviable/8080.conf

     <VirtualHost *:8080>
         # The ServerName directive sets the request scheme, hostname and port that
         # the server uses to identify itself. This is used when creating
         # redirection URLs. In the context of virtual hosts, the ServerName
         # specifies what hostname must appear in the request's Host: header to
         # match this virtual host. For the default virtual host (this file) this
         # value is not decisive as it is used as a last resort host regardless.
         # However, you must set it for any further virtual host explicitly.
         #ServerName www.example.com
    
         ServerAdmin webmaster@localhost
         #DocumentRoot /var/www/html
         #DocumentRoot /home/git/www
    
         # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
         # error, crit, alert, emerg.
         #  It is also possible to configure the loglevel for particular
         # modules, e.g.
         #LogLevel info ssl:warn
    
         ErrorLog ${APACHE_LOG_DIR}/error.log
         CustomLog ${APACHE_LOG_DIR}/access.log combined
    
         #blog proxy
         ProxyPreserveHost On
         ProxyPass / http://localhost:2368/
         ProxyPassReverse / http://localhost:2368/
     </VirtualHost>
    
  2. 链接
    ln -s /etc/apache2/sites-available/8080.conf /etc/apache2/sites-enabled/

jsoncpp

  1. 安装scons

    • 下载gzip(http://www.scons.org/
    • 安装
      tar zxvf scons-2..0.tar.gz && cd scons-2..0 && python setup.py install
  2. 用scons安装jsoncpp

    • 进入到jsoncpp解压目录下,执行命令:
      sudo scons platform=linux-gcc
    • /jsoncpp-src-0.5.0/include/目录下的json文件夹拷贝到/usr/include/
    • jsoncpp-src-0.5.0/libs/linux-gcc-4.9.1/目录下的libjson_linux-gcc-4.9.1_libmt.a拷贝到/usr/local/lib/下,并为了方便使用,将其重命名为libjson.a
  3. 编译:需指定链接库(刚才重命名后的那个文件)
    g++ json.cpp -ljson

全局代理

https://jingsam.github.io/2016/05/08/setup-shadowsocks-http-proxy-on-ubuntu-server.html

swap设置

http://blog.itpub.net/17203031/viewspace-774174/

boost-regex

tar -xzvf boost_1_42_0.tar.gz 
cd boost_1_42_0/libs/regex/build/
make -fgcc.mak
make -fgcc-shared.mak
sudo cp gcc/libboost_regex-gcc-1_42.a /usr/local/lib/libboost_regex.a
sudo cp gcc/libboost_regex-gcc-1_42.so /usr/local/lib/libboost_regex.so
sudo cp ../../../boost -r /usr/local/include/

htmlcxx

http://blog.chinaunix.net/uid-23062171-id-4411061.html

 ( ./configure && make  && sudo make install)

http://www.cnblogs.com/Anker/p/3209876.html

libcurl

sudo apt-get install libcurl4-openssl-dev

libxls

./configure
make
sudo make install
sudo cp -r -v /usr/local/libxls/include/libxls/ /usr/include
sudo cp -r -v /usr/local/libxls/lib/ /usr
sudo cp -r -v /usr/local/libxls/include/xls.h /usr/include

http://www.jb51.net/article/61674.htm

http://www.tuicool.com/articles/JVnqUnE
http://www.cnblogs.com/yangxia-test/p/4195288.html
php7.ini在 /etc/php/7.0/apache2/php.ini

http://www.jianshu.com/p/5b80711f304f

设置jnuVPN

  1. 下载运行安装snx
  2. 运行snx,缺少什么模块就装上去,例如缺 libX11.so.6 apt install libx11-6:i386 libpam0g:i386 libstdc++5:i386
  3. snx以修改路由规则,只需改写/etc/hosts文件,添加如下
    202.116.0.224 jwxt.jnu.edu.cn
  4. 设置定时任务
    1.安装expect apt install tcl tk expect

常用软件

上一篇 下一篇

猜你喜欢

热点阅读