Skip to content

Instantly share code, notes, and snippets.

View SeyedMostafaAhmadi's full-sized avatar

SeyedMostafaAhmadi

View GitHub Profile
@SeyedMostafaAhmadi
SeyedMostafaAhmadi / Domain redirect
Created July 10, 2021 06:50
Domain redirect from specific domain to another domain
# # ----------------------------------------------------------------------
# # | Domain redirect |
# # ----------------------------------------------------------------------
#
# # Redirect from the `domain.net` to the `domain.com` version of the URL.
#
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.net [NC,OR]
# connection to storage server failed
# Solve this error:
# 1- Maybe it means default host in below address is not opened
#go to dir install location roundcube and go to config dir and checkout config.inc.php file;
#$config['default_host'] = 'ssl://webmail.yourdomain.com';
#$config['smtp_server'] = 'ssl://webmail.yourdomain.com';
#check this url that be opened
# 2- maybe it means dovecot is not running.
#run this with "sudo dovecot"
#after run this command if problem to be dovecot maybe ssl license is changed and change it to new ssl license address
first go to /usr/local/apache/conf.d/vhosts.conf
find Directory block for specific your host
Enter
<Directory "/home/username/public_html/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# first enter follow command:
## http_proxy without username and password:
export http_proxy='http://your-ip-address:port'
export https_proxy='https://your-ip-address:port'
## http_proxy with username and password
export http_proxy='http://user:password@your-proxy-ip-address:port'
export https_proxy='https://user:password@your-proxy-ip-address:port'
@SeyedMostafaAhmadi
SeyedMostafaAhmadi / Redirect http to https
Last active June 10, 2018 10:14
copy follow text to .htaccess file in public_html
# # ----------------------------------------------------------------------
# # | Force https |
# # ----------------------------------------------------------------------
#
# # Redirect from the `http://` to the `https://` version of the URL.
# # https://wiki.apache.org/httpd/RewriteHTTPToHTTPS
#
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
<virtualhost ipserver:80>
...
...
...
# before </virtualhost> tag copy follow text
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
</virtualhost>
# Log in to your account using SSH.
# Stop the MySQL server.
service mysqld stop #for Centos and Fedora
service mysql stop #for Debian and Ubuntu
# Restart the MySQL server with the —skip-grant-tables option
mysqld_safe --skip-grant-tables &
@SeyedMostafaAhmadi
SeyedMostafaAhmadi / error mysqldump command
Created January 29, 2018 19:30
mysqldump: Got error: 145: Table ‘./DB/table-name’ is marked as crashed
# Login into MySQL Database Server
mysql -u root -p
# Go to Database Name of concerned table
mysql > use database-name;
# Check and Repair the table
mysqldump -u username -p dbname > dbexport.sql ## mysql export
mysql -u username -p dbname < dbexport.sql ## mysql import
/etc/security/limits.conf
# The file has the following syntax:
# <domain> <type> <item> <value>
# Domain – this includes usernames, groups, guid ranges etc
# Type – soft and hard limits
# Item – the item that will be limited – core size, file size, nproc etc
# Value – this is the value for the given limit