linux debain服务器配置

作者: 刘满 分类: linux 发布时间: 2018-12-02 20:05

debian 软件包 https://packages.debian.org/stable/

whereis apache2
dpkg -L apache2 查看安装的包在哪里

apt-get install locales
dpkg-reconfigure locales
#勾选“en_US.UTF-8”和“zh_CN.UTF-8”
apt-get update#安装时提示404则更新下
apt-get dist-upgrade
apt-get install apache2
apt-get install mysql-server
apt-get install php7.2-fpm
apt-get install php7.2-mbstring
apt-get install php7.2-dom
apt-get install php7.2-curl
apt-get install php7.2-gd
apt-get install php7.2-mysql
service php7.2-fpm restart
apt-get install git
apt-get install node
apt-get install npm
npm install -g pm2
apt-get install redis-server
#composer
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
#apache配置
vi /etc/apache2/apache2.conf
# AllowOverride all
a2enmod rewrite#开启重写模块,取消模块a2dismod
#gzip
a2enmod deflate#压缩模块
a2enmod headers
vi /etc/apache2/mods-available/deflate.conf
#添加
        SetOutputFilter DEFLATE
        SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI .(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
        AddOutputFilterByType DEFLATE text/*
        AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript
        AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
a2enmod deflate
#apache站点
cd /etc/apache2/sites-available
cp -f 000-default.conf xuanzeta.com.conf
vi xuanzeta.com.conf
#重写
#RewriteEngine on 
        #RewriteCond   %{HTTPS} !=on 
        #RewriteRule   ^(.*)  https://%{SERVER_NAME}$1 [L,R] 
#servername
ServerName xuanzeta.com
DocumentRoot /var/www/web
#代理
#DocumentRoot /var/www/zhshht/public
        ProxyPreserveHost On 
        ProxyPass / http://localhost:6001/ 
        ProxyPassReverse / http://localhost:6001/ 

:wq
a2ensite xuanzeta.com.conf#启动站点,取消站点a2dissite
service apache2 reload
service apache2 restart
#远程mysql
#netstat -an|grep 3306 端口未开放
vi /etc/mysql/my.cnf
#bind-address = 127.0.0.1
service mysql restart
mysql -u root -p

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据