Ubuntu的基本使用

// 切到根目录:  
cd /


// 安装apache2
sudo apt-get install apache2


VIM命令

:w   保存文件但不退出vi
:w!  强制保存
:wq  保存并退出
:wq! 强制保存并退出
q:   不保存并退出
:q!  不保存并强制退出


<VirtualHost *:80> 
  ServerAdmin 512113110@qq.com 
  ServerName 0.0.0.0
  DocumentRoot "/home/coding/workspace" #your project list 
  <Directory "/home/coding/workspace/"> 
    Options Indexes FollowSymLinks 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
    </Directory> 
  ErrorLog ${APACHE_LOG_DIR}/abc.error.log 
  CustomLog ${APACHE_LOG_DIR}/abc.access.log combined 
</VirtualHost>


启动apache2

sudo /etc/init.d/apache2 restart 





问题解决1:You don't have permission to access / on this server.

进入apache2.conf,Deny from all改为Allow from all即可:



问题解决2:mkdir(): Permission denied

第一步:确保所有文件属于Apache组和用户。Ubuntu里面,指的是www-data组和用户

chown -R www-data:www-data /home/coding/workspace

第二步:来赋予www-data组所有成员读和写的权限。

chmod -R g+rw /home/coding/workspace







举报

© 著作权归作者所有


0